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

    (@hcabrera)

    Hi @chiefllama,

    Sorry for the late reply.

    The answer is yes, while the plugin doesn’t provide an option for this it is possible with some custom coding, but the actual way to go about it depends on what you’re using to list your popular posts. Is it the WordPress Popular Posts block, the wpp_get_mostpopular() function, or the [wpp] shortcode?

    Thread Starter chiefllama

    (@chiefllama)

    The block, but the shortcode would also work if it’s easier. Thank you.

    Thread Starter chiefllama

    (@chiefllama)

    I figured out how to do it using the function. Using GeneratePress theme so was easy to add as a hook in elements.

    <?php $catID = the_category_ID($echo=false);?>
    <?php
    $args = array(
      			'stats_views' => 0,
    				'post_html' => '<li class="{current_class}"><div class="wpp-item-data">{category}</div> {title}</li>',
    			  'wpp_start' => '<ul class="wpp-list wpp-tiny">',
      			'wpp_end' => '</ul>',	
    	      'limit' => 4,
            'range' => 'last30days',
           	'cat' => $catID, 
    				'stats_category' => 1,
    );
    wpp_get_mostpopular($args);
    ?>

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

The topic ‘Limit to current category?’ is closed to new replies.