I search for a variable that outputs the currently used language of the polylang plugin. Something like:
if($curlang == "en") { ... }
If you are using WordPress version 4.0 or newer, log in to the WordPress administration interface. Click Settings, and then click General. In the Site Language list box, select the language you want WordPress to use, and then click Save Changes. If you are using WordPress version 3.9.
Simply find the row of the page you want to translate and click the + icon next to the flag of the language you want to create a translation for. Again Polylang will automatically link the new page you create to the source page, and the two pages will be considered translations of the same piece of content.
One way to use this hook is to create a shortcode that returns the current language as the 2-letter language code. function get_language_shortcode() { return apply_filters( 'wpml_current_language', null ); } add_shortcode( 'language', 'get_language_shortcode' );
We can use the get_locale
function:
if (get_locale() == 'en_GB') { // drink tea }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With