Top Entertainment Posts – Weekly

Share This Post

$current_post_category_array = get_the_category();
$current_post_category_id = $current_post_category_array[0]->cat_ID;
$current_post_category_name = $current_post_category_array[0]->name;

$args = array(
‘cat’ => $current_post_category_id,
‘orderby’ => ‘comment_count’,
‘posts_per_page’=> 5,
‘date_query’ => array(
array (
‘after’ => ‘1 weeks ago’,)

),

);
// The Query
$popular_category_post_query = new WP_Query( $args );

// The Loop
if ( $popular_category_post_query->have_posts() ) {
echo ‘

‘;
echo ‘

POPULAR ‘.$current_post_category_name.’ POSTS

‘;
while ( $popular_category_post_query->have_posts() ) {
$popular_category_post_query->the_post();
echo ‘‘ . get_the_title() . ‘‘;
}

echo “

“;
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();

The post Top Entertainment Posts – Weekly appeared first on Naijaloaded | Nigeria’s Most Visited Music & Entertainment Website.


Share This Post

Leave A Comment

Your email address will not be published. Required fields are marked *