Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Responsive theme string translation with Polylang

By: Chouby on Jun 21st, 2012  |  syntax: PHP  |  size: 0.81 KB  |  views: 2,500  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }