Quantcast
Viewing all articles
Browse latest Browse all 11471

nac_87 on "[Plugin: Polylang] Problems with wp_query code after update to 1.4.3"

Hi, I'm making a website with two languages and the main page has dynamic content using wp_query.

Today I updated to polylang last version and since then the main page is working properly in the default language. After I press the translation link, the page is not able to get the article data and links through wp_query.

This is the code I'm using:

// FEAT
$args = array(
		'cat' => '9',
		'post_type' => 'post',
		'orderby' => 'rand',
		'lang' => pll_current_language(),
		'posts_per_page' => '1',
		'meta_key' => '_thumbnail_id'
		);
$feat_sh = new WP_Query($args);

// LINKS
$args = array(
		'cat' => '9',
		'post_type' => 'post',
		'orderby' => 'rand',
		'posts_per_page' => '3',
		'lang' => pll_current_language()
		);
$links_sh = new WP_Query($args);

This is only working for the main language, before I did the update is was working properly.

I don't have the same problems eg. in the archive page using this:

$current_cat = get_query_var('cat');

$artc = array(
'cat' => $current_cat,
'orderby' => 'title',
'order' => 'ASC' ,
'paged' => $paged ,
'showposts'=> '5',
'post_type' => 'post', // or define custom post type here
'lang' => pll_current_language()
);

$articles = new WP_Query($artc);

Permalinks are displayed in the mode http://www.site.com/article-name

https://wordpress.org/plugins/polylang/


Viewing all articles
Browse latest Browse all 11471

Trending Articles



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