A nyelvváltó testreszabása a wpml-config.xml fájlban
A beépített WPML nyelvváltó megjelenése és viselkedése XML-ből: CSS, hivatkozások, oldalsáv, lábléc, shortcode, alaphelyzet.
A wpml-config.xml fájlban beállíthatod, hogyan nézzen ki és viselkedjen a beépített WPML nyelvváltó a webhelyen. Ez az útmutató a beépített nyelvváltót testreszabó fejlesztőknek szól. Ha saját nyelvváltót építesz, az egyedi nyelvváltóról szóló fejezet a megfelelő.
Mit szabhatsz testre?
Szekció neve “Mit szabhatsz testre?”- Inline CSS-stílusok: egyedi CSS közvetlenül a nyelvváltóra.
- Hivatkozás a le nem fordított tartalomra: megmondhatod, megjelenjen-e vagy el legyen-e rejtve.
- Másolandó URL-paraméterek: megadhatod, mely paramétereket kell átvinni nyelvváltáskor.
- Oldalsáv és lábléc nyelvváltója: a megjelenése:
- látszanak-e zászlók és/vagy nyelvnevek;
- az aktuális nyelv hivatkozásként látszik-e;
- a nyelvváltó widget címe;
- a megjelenítési sablon;
- szöveg-, háttér- és szegélyszínek hexadecimális színkóddal.
- Shortcode-műveletek: a shortcode-dal beszúrt nyelvváltók megjelenése.
Példa a beépített WPML nyelvváltó egyedi beállítására:
<wpml-config> <language-switcher-settings> <key name="additional_css">{inline CSS styles}</key> <key name="link_empty">{0 or 1}</key> <key name="copy_parameters">{parameter1, parameter2}</key> <key name="sidebars"> <key name="{sidebar slug}"> <key name="display_flags">{0 or 1}</key> <key name="display_names_in_current_lang">{0 or 1}</key> <key name="display_names_in_native_lang">{0 or 1}</key> <key name="display_link_for_current_lang">{0 or 1}</key> <key name="widget_title">{widget title}</key> <key name="template">{template slug}</key> <!-- color picker keys --> <key name="background_normal">#{hex color}</key> <key name="border_normal">#{hex color}</key> <key name="font_current_normal">#{hex color}</key> <key name="font_current_hover">#{hex color}</key> <key name="background_current_normal">#{hex color}</key> <key name="background_current_hover">#{hex color}</key> <key name="font_other_normal">#{hex color}</key> <key name="font_other_hover">#{hex color}</key> <key name="background_other_normal">#{hex color}</key> <key name="background_other_hover">#{hex color}</key> </key> </key> <key name="statics"> <key name="footer"> <key name="show">{0 or 1}</key> <key name="display_flags">{0 or 1}</key> <key name="display_names_in_current_lang">{0 or 1}</key> <key name="display_names_in_native_lang">{0 or 1}</key> <key name="display_link_for_current_lang">{0 or 1}</key> <key name="template">{template slug}</key> <!-- color picker keys --> <key name="background_normal">#{hex color}</key> <key name="border_normal">#{hex color}</key> <key name="font_current_normal">#{hex color}</key> <key name="font_current_hover">#{hex color}</key> <key name="background_current_normal">#{hex color}</key> <key name="background_current_hover">#{hex color}</key> <key name="font_other_normal">#{hex color}</key> <key name="font_other_hover">#{hex color}</key> <key name="background_other_normal">#{hex color}</key> <key name="background_other_hover">#{hex color}</key> </key> <key name="post_translations"> <key name="show">{0 or 1}</key> <key name="display_flags">{0 or 1}</key> <key name="display_names_in_current_lang">{0 or 1}</key> <key name="display_names_in_native_lang">{0 or 1}</key> <key name="display_link_for_current_lang">{0 or 1}</key> <key name="display_before_content">{0 or 1}</key> <key name="display_after_content">{0 or 1}</key> <key name="template">{template slug}</key> <key name="availability_text">{string like "See post translations: %s"}</key> </key> <key name="shortcode_actions"> <key name="display_flags">{0 or 1}</key> <key name="display_names_in_current_lang">{0 or 1}</key> <key name="display_names_in_native_lang">{0 or 1}</key> <key name="display_link_for_current_lang">{0 or 1}</key> <key name="template">{template slug}</key> <!-- color picker keys --> <key name="background_normal">#{hex color}</key> <key name="border_normal">#{hex color}</key> <key name="font_current_normal">#{hex color}</key> <key name="font_current_hover">#{hex color}</key> <key name="background_current_normal">#{hex color}</key> <key name="background_current_hover">#{hex color}</key> <key name="font_other_normal">#{hex color}</key> <key name="font_other_hover">#{hex color}</key> <key name="background_other_normal">#{hex color}</key> <key name="background_other_hover">#{hex color}</key> </key> </key> </language-switcher-settings></wpml-config>Nem kell minden szakasznak szerepelnie a fájlban, csak azoknak, amelyek a témádra vagy bővítményedre vonatkoznak.
A nyelvváltó visszaállítása alapértelmezettre
Szekció neve “A nyelvváltó visszaállítása alapértelmezettre”A wpml-config.xml fájllal visszaállíthatod a nyelvváltó beállításait, ha azokat a háttérfelületen megváltoztatták a kezdeti értékekről. Az új értékek megjelenéséhez kattints a Restore default gombra a WPML → Settings → Language Switchers oldal alján.
Az általános tudnivalókat a Nyelvi konfigurációs fájl fejezet tartalmazza.
Készült: