Home » WordPress » EXTRA » Show more than 3 post in trending bar



Show more than 3 post in trending bar

EXTRA No Comments

Have you ever noticed that the trending bar in the secondary menu, top left of header only shows 3 posts? What??? Never noticed, until someone mentioned it in one of these groups I’m in. With that said, I of course, had to rectify the situation immediately and did an exhaustive Google Search and found the following piece of nice code. WARNING: Do this in your child theme functions only. If you don’t have a child theme, there’s plenty of plugins that can create one for you.

HERE’S THE CODE to add to your child theme functions.php The text in bold, you can change. I personally, removed the entire ‘category name’:

add_action(‘extra_trending_posts_query’,function() {
return array(
‘post_type’ => ‘post’,
‘post_status’ => ‘publish’,
‘category_name’ => ‘Category Name‘,
‘posts_per_page’ => ‘20‘,
‘orderby’ => ‘title‘,
‘order’ => ‘DESC‘,
);
});

For full article, go here:
https://divi.tutsdirectory.com/listing/how-to-show-post-notification-for-individual-category-in-trending-bar/

LEAVE A COMMENT