Filter Posts by Current Language (WPML)
-
Hi,
I’m using the WordPress Popular Posts plugin on a multilingual site with WPML, but I’m encountering an issue: the widget shows posts from all languages instead of filtering posts by the current language.
This is the code I’m using to display the popular posts:
<?php
$args = array(
'wpp_start' => '<ol style="padding: 0;">',
'wpp_end' => '</ol>',
'post_html' => '<li style="list-style: none;" class="list-popolari">
<div class="flex-display responsive-popolari">
<div class="col-30 anteprima-articoli1">{thumb}</div>
<div class="col-70 col-70-popolari">
<a href="{url}"><h3>{text_title}</h3></a>
<p class="scrittoda">
<i class="far fa-calendar-alt"></i>{date}
</p>
<p>{summary}</p>
</div>
</div>
</li>
<hr class="hr-articoli">',
'thumbnail_width' => 400,
'thumbnail_height' => 300,
'excerpt_length' => 350,
'stats_date' => 1,
'stats_date_format' => 'j F, Y',
'limit' => 3,
'title_length' => 60
);
if (function_exists('wpp_get_mostpopular')) {
$popolari = wpp_get_mostpopular($args);
}
?>I’ve tried adding a filter to display posts based on the current language (using wpp_query_posts with WPML), but it doesn’t seem to work.
Is there an official or recommended way to make the plugin display posts only in the current language when using WPML? Could you provide an example implementation or guidance on how to configure this correctly?
Thanks in advance for your help!
The page I need help with: [log in to see the link]
The topic ‘Filter Posts by Current Language (WPML)’ is closed to new replies.