New Paste

 

Recent Pastes

Administrate




PageLines PasteBin.

PasteID: 8w8
Pasted by Jan Peeters, 2012-10-12 09:50:23 GMT
Expires Never
Paste size 1.05 Kb
Toggle Expand   Wrap   Raw
Copy Contents   Copy URL
 
  1. <?php
  2. /*
  3. Plugin Name: Polylang translates Pagelines strings
  4. */
  5.  
  6. add_action('pagelines_hook_pre', 'pll_pagelines_settings');
  7.  
  8. function pll_pagelines_settings() {
  9. 	if (function_exists('pll_register_string'))
  10. 		add_filter('option_pagelines-settings-two', 'translate_pagelines_settings');
  11.  
  12. 	$pll_options = get_option('polylang');
  13. 	if (!($GLOBALS['wp_rewrite']->using_permalinks() && $pll_options['force_lang']))
  14. 		add_action('wp', 'pll_reload_pl_settings');
  15. }
  16.  
  17. // reload pagelines settings to translate them when Polylang defers language loading
  18. function pll_reload_pl_settings() {
  19. 	$GLOBALS['global_pagelines_settings'] = ( array ) get_option(PAGELINES_SETTINGS);
  20. }
  21.  
  22. // translates strings in the array $to_translate
  23. function translate_pagelines_settings($values) {
  24. 	$to_translate = array(
  25. 		'metabar_standard',
  26. 		'continue_reading_text'
  27. 	);
  28. 	foreach ($values as $key=>$value) {
  29. 		if (in_array($key, $to_translate)) {
  30. 			pll_register_string($key, $value);
  31. 			$values[$key] = pll__($value);		
  32. 		}
  33. 	}
  34. 	return $values;
  35. }
 
 
 

 
 
 
 
 
Written by Xan Manning, 2010.
YOU NEED FLASH!