![]() ‘$slug’ => 2-letters code of the language.Use the standard WP is_front_page function instead. Returns the id of the translated term as integer. ‘$term_id’ => (required) id of the term you want the translation.Returns the category (or post tag) translation Returns the id of the translated post or page as integer. ‘$slug’ => (optional) 2-letters code of the language, defaults to current language.‘$post_id’ => (required) id of the post you want the translation.Returns either the full name, or the WordPress locale (just as the WordPress core function ‘get_locale’ or the slug ( 2-letters code) of the current language. ‘$value’ => (optional) either ‘name’ or ‘locale’ or ‘slug’, defaults to ‘slug’.=> true if there is no available translation, false otherwise.=> true if this is the current language, false otherwise.The function will return an array of arrays, one array per language with the following entries: If the options are not enough, you can build your own custom language switcher using the ‘raw’ argument: $translations = pll_the_languages(array('raw'=>1)) You have to output yourself the ul tags if you don’t use the dropdown option. If you want the same comportment as provided by the widget, you can find the corresponding code in the file polylang/include/widget.php. Important: When using the language switcher as a dropdown, you must provide yourself the action attached to the language switching. ‘raw’ => use this to create your own custom language switcher (default:0).‘post_id’ => if set, displays links to translations of the post (or page) defined by post_id (default: null).‘hide_current’=> hides the current language if set to 1 (default: 0).‘hide_if_no_translation’ => hides the language if no translation exists if set to 1 (default: 0).‘echo’ => echoes if set to 1, returns a string if set to 0 (default: 1).‘force_home’ => forces link to homepage if set to 1 (default: 0).‘hide_if_empty’ => hides languages with no posts (or pages) if set to 1 (default: 1).‘show_flags’ => displays flags if set to 1 (default: 0).‘display_names_as’ => either ‘name’ or ‘slug’ (default: ‘name’).‘show_names’ => displays language names if set to 1 (default: 1).‘dropdown’ => displays a list if set to 0, a dropdown list if set to 1 (default: 0).IMPORTANT: when using one or more of these function, you *must* check for the its existence before using it, otherwise your site will badly break with a fatal error at next Polylang update (as WordPress deletes the plugin when updtating it). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |