示例#1
0
 public function init()
 {
     parent::init();
     if (!did_action('pll_language_defined')) {
         $this->set_language_from_url();
     }
     add_action('request', array(&$this, 'request'));
 }
 /**
  * defers the language choice to the 'wp' action (when the content is known)
  *
  * @since 1.8
  */
 public function init()
 {
     parent::init();
     if (!did_action('pll_language_defined')) {
         // set the languages from content
         add_action('wp', array($this, 'wp'), 5);
         // priority 5 for post types and taxonomies registered in wp hook with default priority
         // if no language found, choose the preferred one
         add_filter('pll_get_current_language', array($this, 'pll_get_current_language'));
     }
 }