Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

Chouby on "[Plugin: Polylang] Theme Menus Links (CPT Pages) shown for all languages"

$
0
0

Well I don't know WP-Ecommerce so I must admit that I am a bit lost.

What changed between 1.2.4 and 1.3 and which I think probably impacted you (because it was what I played around in 1.2dev57 too) is the 'parse_query' function in frontend/frontend.php:

if (isset($query->tax_query->queries))
	foreach ($query->tax_query->queries as $tax)
		if (pll_is_translated_taxonomy($tax['taxonomy']))
			$has_tax = true;

// allow filtering recent posts and secondary queries by the current language
// take care not to break queries for non visible post types such as nav_menu_items
// do not filter if lang is set to an empty value
// do not filter single page and translated taxonomies
if (/*$query->is_home &&*/ !empty($this->curlang) && !isset($qv['lang']) && !$has_tax && empty($qv['page_id']) && empty($qv['pagename']) && (empty($qv['post_type']) || $this->model->is_translated_post_type($qv['post_type'])))
	$query->set('lang', $this->curlang->slug);

has been moved to:

if (isset($query->tax_query->queries))
	foreach ($query->tax_query->queries as $tax)
		if ('post_format' != $tax['taxonomy'])
			$has_tax = true;

// allow filtering recent posts and secondary queries by the current language
// take care not to break queries for non visible post types such as nav_menu_items
// do not filter if lang is set to an empty value
// do not filter single page and translated taxonomies to avoid conflicts
if (!empty($this->curlang) && !isset($qv['lang']) && !$has_tax && empty($qv['page_id']) && empty($qv['pagename']) && (empty($qv['post_type']) || $this->model->is_translated_post_type($qv['post_type']))) {
	$this->choose_lang->set_lang_query_var($query, $this->curlang);
}

and to understand the new 'set_lang_query_var' function, this is how it is defined in frontend/choose-lang.php:

public function set_lang_query_var(&$query, $lang) {
	// backward compatibility WP < 3.5
	if (version_compare($GLOBALS['wp_version'], '3.5' , '<')) {
		$query->set('lang', $lang->slug);
	}
	else {
		// defining directly the tax_query (rather than setting 'lang' avoids transforming the query by WP)
		$query->query_vars['tax_query'][] = array(
			'taxonomy' => 'language',
			'field'    => 'term_taxonomy_id', // since WP 3.5
			'terms'    => $lang->term_taxonomy_id,
			'operator' => 'IN'
		);
	}
}

So as you can see, I now don't set anymore the language on single pages to avoid a conflict (I was aware of that but forgot it in 1.2.x)

Could you check that reverting this change does solve your issue?


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>