Skip to content

Instantly share code, notes, and snippets.

@icetee
Last active March 20, 2023 12:54
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save icetee/fbbfef5534fead58611e to your computer and use it in GitHub Desktop.
Save icetee/fbbfef5534fead58611e to your computer and use it in GitHub Desktop.
Polylang function_exists (active the plugin) - WordPress - Paste the code into functions.php
/*
* Polylang Language API functions tester - WordPress
* Github: https://gist.github.com/icetee/fbbfef5534fead58611e
*
*/
function ex_pll_the_languages($arg = '') {
if ( function_exists('pll_the_languages') ) {
return pll_the_languages($arg);
}
}
function ex_pll_current_language($slug = '') {
if ( function_exists('pll_current_language') ) {
return pll_current_language($slug);
}
}
function ex_pll_default_language($slug = '') {
if ( function_exists('pll_default_language') ) {
return pll_default_language($slug);
}
}
function ex_pll_get_post($post_id, $slug = '') {
if ( function_exists('pll_get_post') ) {
return pll_get_post($post_id, $slug);
}
}
function ex_pll_get_term($term_id, $slug = '') {
if ( function_exists('pll_get_term') ) {
return pll_get_term($term_id, $slug);
}
}
function ex_pll_home_url($slug = '') {
if ( function_exists('pll_home_url') ) {
return pll_home_url($slug);
}
}
function ex_pll_register_string($name, $string, $group = "polylang", $multiline = false) {
if ( function_exists('pll_register_string') ) {
return pll_register_string($name, $string, $group, $multiline);
}
}
function ex_pll__($string) {
if ( function_exists('pll__') ) {
return pll__($string);
} else {
return __($string);
}
}
function ex_pll_e($string) {
if ( function_exists('pll_e') ) {
return pll_e($string);
} else {
return __($string);
}
}
function ex_pll_translate_string($string, $lang) {
if ( function_exists('pll_translate_string') ) {
return pll_translate_string($string, $lang);
}
}
function ex_pll_is_translated_post_type($post_type) {
if ( function_exists('pll_is_translated_post_type') ) {
return pll_is_translated_post_type($post_type);
}
}
function ex_pll_is_translated_taxonomy($tax) {
if ( function_exists('pll_is_translated_taxonomy') ) {
return pll_is_translated_taxonomy($post_type);
}
}
function ex_pll_languages_list($args = array()) {
if ( function_exists('pll_languages_list') ) {
return pll_languages_list($args);
}
}
function ex_pll_get_post_language($post_id, $field = "slug") {
if ( function_exists('pll_get_post_language') ) {
return pll_get_post_language($post_id, $field);
}
}
function ex_pll_get_term_language($term_id, $field = "slug") {
if ( function_exists('pll_get_term_language') ) {
return pll_get_term_language($term_id, $field);
}
}
function ex_pll_set_post_language($post_id, $lang) {
if ( function_exists('pll_set_post_language') ) {
return pll_set_post_language($post_id, $lang);
}
}
function ex_pll_set_term_language($term_id, $lang) {
if ( function_exists('pll_set_term_language') ) {
return pll_set_term_language($term_id, $lang);
}
}
function ex_pll_save_post_translations($arr) {
if ( function_exists('pll_save_post_translations') ) {
return pll_save_post_translations($arr);
}
}
function ex_pll_save_term_translations($arr) {
if ( function_exists('pll_save_term_translations') ) {
return pll_save_term_translations($arr);
}
}
function ex_pll_count_posts($lang, $args = array()) {
if ( function_exists('pll_count_posts') ) {
return pll_count_posts($lang, $args);
}
}
@icetee
Copy link
Author

icetee commented Jun 21, 2015

Paste into "functions.php" or paste the line:
require get_template_directory() . '/inc/wp_ext_pll_functions.php';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment