• Resolved monitor

    (@oomskaap)


    I currently use this code to get the WP-Post views plugin’s views, but it does not support a date. So i want to transfer over to this plugin and include a date of last week.

    <?php
    $cat_id='-8';//the category ID
    $limit = get_option('posts_per_page');
    
    query_posts(array('category__and'=>array(276),
    'showposts'=>8,'more' => $more = 0,
    'meta_key' => 'views',
    'orderby' => 'meta_value_num',
    'order' => 'DESC',
    ));
    ?>

    How, and where and what do i have to put in the above code for it to work?

    Thanks!

    https://www.ads-software.com/extend/plugins/wordpress-popular-posts/

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

    (@hcabrera)

    Hi oomskaap,

    WordPress Popular Posts has its own template tag called wpp_get_mostpopular() that you can use to get the most viewed posts from last 7 days (please note I said days, and not week).

    Here’s an example:

    <?php
    if (function_exists( 'wpp_get_mostpopular' )) {
      wpp_get_mostpopular('range=weekly&cat=276&order_by=views&limit=8');
    }
    ?>

    That code would get the most viewed posts belonging to the category 276 (as seen at your code) from the past 7 days.

    Thread Starter monitor

    (@oomskaap)

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WordPress Popular Posts] Template query for most viewed of last week post’ is closed to new replies.