Title: fazluldev's Replies | WordPress.org

---

# fazluldev

  [  ](https://wordpress.org/support/users/fazluldev/)

 *   [Profile](https://wordpress.org/support/users/fazluldev/)
 *   [Topics Started](https://wordpress.org/support/users/fazluldev/topics/)
 *   [Replies Created](https://wordpress.org/support/users/fazluldev/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/fazluldev/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/fazluldev/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/fazluldev/engagements/)
 *   [Favorites](https://wordpress.org/support/users/fazluldev/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WebberZone Top 10 — Popular Posts] Top 10 Polylang custom time period](https://wordpress.org/support/topic/top-10-polylang-custom-time-period/)
 *  Thread Starter [fazluldev](https://wordpress.org/support/users/fazluldev/)
 * (@fazluldev)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/top-10-polylang-custom-time-period/#post-11477228)
 * **Am I right to understand that you want to show the normal period in German 
   but 180 days top posts (or posts posted in the top 180 days) if it is English?**
   ——-
   >> For German post, your plugin works perfectly. >>> In the English post, its
   already show top popular post but I want to show, top popular post but only for
   last 180 days!
 * **I’m not familiar with how PolyLang works, to be honest. What output are you
   seeing with your code ?**
    ——– it shows the top popular post but not rendered
   last 180 days.
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WebberZone Top 10 — Popular Posts] Top 10 Polylang custom time period](https://wordpress.org/support/topic/top-10-polylang-custom-time-period/)
 *  Thread Starter [fazluldev](https://wordpress.org/support/users/fazluldev/)
 * (@fazluldev)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/top-10-polylang-custom-time-period/#post-11461795)
 * In function.php i wrote this data_query but it won’t work that what i looking
   for.
 * `function tptn_filter_posts_per_language($posts){
    global $polylang; $args = 
   array( ‘posts_per_page’ => 5, ‘post_type’ => ‘post’, ‘orderby’ => ‘comment_count’,‘
   order’ => ‘DESC’, ‘date_query’ => array( ‘after’ => date(‘Y-m-d’, strtotime(‘-
   180 days’)) ) ); $_posts = get_posts($args);
 *  /** $_posts = array(); **/
 *  $limitPostsPerLanguage = 5; // show only 5 posts on home
    $currentLanguage =
   pll_current_language(‘slug’);
 *  foreach($posts as $post) {
    $lang = $polylang->model->get_post_language($post[‘
   ID’])->slug; if ($currentLanguage == $lang) { $_posts[] = $post; } if (count(
   $_posts) >= $limitPostsPerLanguage) { break; } } return $_posts; } add_filter(‘
   tptn_pop_posts_array’,’tptn_filter_posts_per_language’);

Viewing 2 replies - 1 through 2 (of 2 total)