Answer the question
In order to leave comments, you need to log in
Wordpress, how to create your own Polylang language switcher?
I pulled a landing page on WordPress. Made multilingual with Polylang. But the standard switch does not suit me. I came to this decision: I created my own switch and put up links like "my_site.ru/ru", "my_site.ru/uk". Everything works fine, but is this the right solution? Would it be suitable for a multi-page site?
Answer the question
In order to leave comments, you need to log in
From documentation :
$args = array(
'dropdown' => 0, // displays a list if set to 0, a dropdown list if set to 1 (default: 0)
'show_names' => 1, // displays language names if set to 1 (default: 1)
'display_names_as' => 'name', // either ‘name’ or ‘slug’ (default: ‘name’)
'show_flags' => 1, // displays flags if set to 1 (default: 0)
'hide_if_empty' => 1, // hides languages with no posts (or pages) if set to 1 (default: 1)
'force_home' => 0, // forces link to homepage if set to 1 (default: 0)
'echo' => 1, // echoes if set to 1, returns a string if set to 0 (default: 1)
'hide_if_no_translation' => 1, // hides the language if no translation exists if set to 1 (default: 0)
'hide_current' => 0, // hides the current language if set to 1 (default: 0)
'post_id' => null, // if set, displays links to translations of the post (or page) defined by post_id (default: null)
'raw' => 0, // use this to create your own custom language switcher (default:0)
);
pll_the_languages( $args );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question