• Resolved tickpdm

    (@tickpdm)


    Hi,

    first of all thanks for the great plugin. Basically, it works brilliantly. However, I have problems on the side of another language. My site is multilingual. The plugin works on the German side, on the English side the error message appears that no data is available. What am I doing wrong?

    This is my code, which I use on the category pages:

    	<?php
    $args = array(
    	
          'header' => 'Top Ten ',
          'header_start' => '<h3>',
          'header_end' => '</h3>',
    	  'limit' => 10,
       	 'thumbnail_width' => 100,
          'thumbnail_height' => 75,
    	  'excerpt_length' => 600,
    	  'range' => 'all',
    	  'order_by' => 'views',
    	  'cat' => $cat_id,
    	  'stats_category' => 1,
    	  'wpp_start' => '<div class="category-description">',
          'wpp_end' => '</div>',
    	  'post_html' => '<br><h4><a href="{url}">{text_title} {stats}</h4> <p>{excerpt}</p><br><br></a>',
        	
    );
    wpp_get_mostpopular($args);
    ?>

    I determine the category ID as follows:

    $categories = get_category( get_query_var( 'cat' ) );
    $category_name = $categories->name;
    $category_description = $categories->category_description;
    $cat_id = $categories->cat_ID;

    I hope you can help me and sorry for the bad english.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @tickpdm,

    Well, either WPP can’t find popular Posts under the “Italy” category, or this, or a combination of both.

    Thread Starter tickpdm

    (@tickpdm)

    Hi, thanks for the reply. But there are posts in Italy / Rome available. Why does he only recognize them for the German translation?

    Thread Starter tickpdm

    (@tickpdm)

    You can also see them in the blog under the category description .

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yes, I know that there are posts under the Italy category. I checked your website before replying πŸ˜›

    What I meant to say before is that the issue is most likely the category filter. WPP can’t find popular posts under that category ID, hence the reason why you get that “no data” message.

    As to why it happens, can’t say without more details. What plugin are you using to translate your posts?

    Thread Starter tickpdm

    (@tickpdm)

    Poly Lang Plugin

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, please give this a shot:

    $categories = get_category( get_query_var( 'cat' ) );
    $category_name = $categories->name;
    $category_description = $categories->category_description;
    $cat_id = $categories->cat_ID;
    
    $default_language = pll_default_language();
    $terms_translations = pll_get_term_translations($cat_id);
    
    if ( $cat_id != $terms_translations[$default_language] )
    	$cat_id = $terms_translations[$default_language];
    
    $args = array(
    	'header' => 'Top Ten ',
    	'header_start' => '<h3>',
    	'header_end' => '</h3>',
    	'limit' => 10,
    	'thumbnail_width' => 100,
    	'thumbnail_height' => 75,
    	'excerpt_length' => 600,
    	'range' => 'all',
    	'order_by' => 'views',
    	'cat' => $cat_id,
    	'stats_category' => 1,
    	'wpp_start' => '<div class="category-description">',
    	'wpp_end' => '</div>',
    	'post_html' => '<br><h4><a href="{url}">{text_title} {stats}</h4> <p>{excerpt}</p><br><br></a>',
    );
    wpp_get_mostpopular($args);
    • This reply was modified 4 years, 3 months ago by Hector Cabrera. Reason: Fixed code formatting
    Thread Starter tickpdm

    (@tickpdm)

    It works. Great. Many Thanks.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Don’t mention it. Glad I could help!

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

The topic ‘Sorry. No data so far.’ is closed to new replies.