PluginProbe
Polylang / 0.6
Polylang v0.6
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / include / api.php

api.php in Polylang 0.6, at include/api.php

44 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 // register strings for translation in the "strings translation" panel
28 function pll_register_string($name, $string) {
29 global $polylang;
30 if ($polylang)
31 $polylang->register_string($name, $string);
32 }
33
34 // translates string (previously registered with pll_register_string)
35 function pll__($string) {
36 return __($string, 'pll_string');
37 }
38
39 // echoes translated string (previously registered with pll_register_string)
40 function pll_e($string) {
41 _e($string, 'pll_string');
42 }
43 ?>
44