
Responsive theme string translation with Polylang
By:
Chouby on
Jun 21st, 2012 | syntax:
PHP | size: 0.81 KB | hits: 750 | expires: Never
<?php
/*
Plugin Name: Polylang for responsive theme
*/
/*
* This plugin is obsolete since Polylang 1.0 (the functionnality is now included in Polylang)
*/
add_action('admin_init', create_function('', 'get_option("responsive_theme_options");')); // to call the option filter on admin side
add_filter('option_responsive_theme_options', 'translate_responsive_theme_strings');
function translate_responsive_theme_strings($options) {
if (function_exists('pll_register_string')) { // test polylang is activated
$strings = array('home_headline', 'home_subheadline', 'home_content_area', 'cta_text', 'cta_url');
foreach ($strings as $str) {
if (is_admin())
pll_register_string('responsive theme', $options[$str]);
else
$options[$str] = pll__($options[$str]);
}
}
return $options;
}