1. <?php
  2. /*
  3. Plugin Name: Polylang translates bizway strings
  4. */
  5.  
  6. add_filter('option_bizway_options', 'translate_bizway_options');
  7.  
  8. function translate_bizway_options($options) {
  9.     if (function_exists('pll_register_string')) {
  10.         $to_translate = array('bizway_first_head', 'bizway_second_head', 'bizway_firsthead', 'bizway_firstdesc', 'bizway_secondhead', 'bizway_seconddesc', 'bizway_thirdhead', 'bizway_thirddesc');
  11.         foreach ($options as $key=>$option) {
  12.             if (in_array($key, $to_translate)) {
  13.                 if (is_admin())
  14.                     pll_register_string($key, $option);
  15.                 else
  16.                     $options[$key] = pll__($option);
  17.             }
  18.         }
  19.     }
  20.     return $options;
  21. }