public function _meta_setup() { $action = $this->controller->get_current_action(); if (!$action) { return; } require_once WPBDP_PATH . 'core/class-page-meta.php'; $this->page_meta = new WPBDP_Page_Meta($action); $this->_do_wpseo = defined('WPSEO_VERSION') ? true : false; if ($this->_do_wpseo) { $wpseo_front = null; if (isset($GLOBALS['wpseo_front'])) { $wpseo_front = $GLOBALS['wpseo_front']; } elseif (class_exists('WPSEO_Frontend') && method_exists('WPSEO_Frontend', 'get_instance')) { $wpseo_front = WPSEO_Frontend::get_instance(); } remove_filter('wp_title', array($this, '_meta_title'), 10, 3); add_filter('wp_title', array($this, '_meta_title'), 16, 3); if (is_object($wpseo_front)) { remove_filter('wp_title', array(&$wpseo_front, 'title'), 15, 3); remove_action('wp_head', array(&$wpseo_front, 'head'), 1, 1); } add_action('wp_head', array($this, '_meta_keywords')); } remove_filter('wp_head', 'rel_canonical'); add_filter('wp_head', array($this, '_meta_rel_canonical')); if ('showlisting' == $action && wpbdp_rewrite_on()) { add_action('wp_head', array(&$this, 'listing_opentags')); } }
function translate_link($link, $lang = null) { $lang = $lang ? $lang : $this->get_current_language(); if (!$lang) { return $link; } if (wpbdp_rewrite_on()) { $main_id = wpbdp_get_page_id('main'); $trans_id = icl_object_id($main_id, 'page', false, $lang); if (!$trans_id) { return $link; } $link = str_replace(_get_page_link($main_id), _get_page_link($trans_id), $link); $link = add_query_arg('lang', $lang, $link); } else { $link = add_query_arg('lang', $lang, $link); } return $link; }