get popular post of a week updated based on view count
-
I used this code `<?php
//Set the parameters / arguments for the query
$popular_post_args = array(‘meta_key’ => ‘post_views_count’, //meta key currently set
‘orderby’ => ‘meta_value_num’, //orderby currently set
‘order’ => ‘DESC’, //order currently set
‘posts_per_page’ => 10, // show 2 posts
‘date_query’ => array( // date query from after 1 week ago
array(
‘after’ => ‘1 week ago’,
),
),
);//Initialise the Query and add the arguments
$popular_posts = new WP_Query( $popular_post_args );//Check if theres posts and add your html divs around it
if ( $popular_posts->have_posts() ) : ?><?php
//Start the loop
while ( $popular_posts->have_posts() ) : $popular_posts->the_post(); ?>` on my site to get popular post of a week but the problem is that it is not functioning properly. Please is there any way I can update this posts each time any post view increases it will automatically list it as the most viewed in a week not regarding if the post is just published. Please this is really the last thing bordering me on my site tophits
Thanks in advance.The page I need help with: [log in to see the link]
- The topic ‘get popular post of a week updated based on view count’ is closed to new replies.