<?php
// returns the WordPress locale in the format ‘en_US’
$locale = get_locale();
// returns the locale in the format en-US
$language = get_bloginfo( 'language' );
// current displayed language
$cur_language = pll_current_language( 'slug' );
// default language
$default_language = pll_default_language( 'slug' );
// get translated post using slug
$t_post = pll_get_post($post_id, $slug);
// get post's language as slug
$post_lang = pll_get_post_language($post_id, 'slug');
/*
Array
(
[locale] => zh_TW
[language] => zh-TW
[cur_language] => zh_tw
[default_language] => en
)
Array
(
[locale] => en_US
[language] => en-US
[cur_language] => en
[default_language] => en
)
*/
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.