| 1 |
<?php |
| 2 |
|
| 3 |
// template tag: displays the language switcher |
| 4 |
function pll_the_languages($args = '') { |
| 5 |
global $polylang; |
| 6 |
return isset($polylang) ? $polylang->the_languages($args) : ''; |
| 7 |
} |
| 8 |
|
| 9 |
// among the post and its translations, returns the id of the post which is in the language represented by $slug |
| 10 |
function pll_get_post($post_id, $slug) { |
| 11 |
global $polylang; |
| 12 |
return isset($polylang) ? $polylang->get_post($post_id, $slug) : null; |
| 13 |
} |
| 14 |
|
| 15 |
// among the term and its translations, returns the id of the term which is in the language represented by $slug |
| 16 |
function pll_get_term($term_id, $slug) { |
| 17 |
global $polylang; |
| 18 |
return isset($polylang) ? $polylang->get_term($term_id, $slug) : null; |
| 19 |
} |
| 20 |
|
| 21 |
// acts as is_front_page but knows about translated front page |
| 22 |
function pll_is_front_page() { |
| 23 |
global $polylang; |
| 24 |
return isset($polylang) ? $polylang->is_front_page() : null; |
| 25 |
} |
| 26 |
|
| 27 |
?> |
| 28 |
|