Advertisement
Chouby

Responsive theme string translation with Polylang

Jun 21st, 2012
6,146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: Polylang for responsive theme
  4. */
  5.  
  6. /*
  7.  * This plugin is obsolete since Polylang 1.0 (the functionnality is now included in Polylang)
  8.  */
  9.  
  10. add_action('admin_init', create_function('', 'get_option("responsive_theme_options");')); // to call the option filter on admin side
  11. add_filter('option_responsive_theme_options', 'translate_responsive_theme_strings');
  12.  
  13. function translate_responsive_theme_strings($options) {
  14.     if (function_exists('pll_register_string')) { // test polylang is activated
  15.         $strings = array('home_headline',  'home_subheadline', 'home_content_area', 'cta_text',  'cta_url');
  16.         foreach ($strings as $str) {
  17.             if (is_admin())
  18.                 pll_register_string('responsive theme', $options[$str]);
  19.             else
  20.                 $options[$str] = pll__($options[$str]);
  21.         }
  22.     }
  23.     return $options;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement