public function __construct(&$polylang) { parent::__construct($polylang); // add post state for translations of the front page and posts page add_filter('display_post_states', array(&$this, 'display_post_states'), 10, 2); // refresh language cache when a static front page has been translated add_action('pll_save_post', array(&$this, 'pll_save_post'), 10, 3); // checks if chosen page on front is translated add_filter('pre_update_option_page_on_front', array(&$this, 'update_page_on_front'), 10, 2); }
/** * Constructor: setups filters and actions * * @since 1.8 * * @param object $polylang */ public function __construct(&$polylang) { parent::__construct($polylang); $this->links_model =& $polylang->links_model; $this->links =& $polylang->links; $this->curlang =& $polylang->curlang; add_action('pll_language_defined', array($this, 'pll_language_defined')); add_action('pll_home_requested', array($this, 'pll_home_requested')); // Manages the redirection of the homepage add_filter('redirect_canonical', array($this, 'redirect_canonical'), 10, 2); add_filter('pll_pre_translation_url', array($this, 'pll_pre_translation_url'), 10, 3); add_filter('pll_check_canonical_url', array($this, 'pll_check_canonical_url')); add_filter('pll_set_language_from_query', array($this, 'page_on_front_query'), 10, 2); add_filter('pll_set_language_from_query', array($this, 'page_for_posts_query'), 10, 2); }