Polylang – display one post into 3 categories with different lang

I use Plugin Polylang.
I need to display one post into 3 categories (one category, but for any language for plugin polylang need to create 3 different categories), important to make this without dublicating post for any category, because i need to make 1 common post(with common rating) for all langs.
I tried in theme_folder/category.php before if ( have_posts() ) : set:

$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$posts = get_posts( array(
‘category’ => pll_get_term($category_id, ‘ro’),
‘post_type’ => ‘post’,
) );

nothing changes…
and:

$posts = get_posts( array(
‘category’=> $category_id,
‘post_type’ => ‘post’,
‘lang’ => ‘ro’,
) );

result: working correctly only if language is ‘ro’, if i change language in site, display only empty posts.

Thanks

Read more here:: Polylang – display one post into 3 categories with different lang

Leave a Reply

Your email address will not be published. Required fields are marked *