Show more than 3 post in trending bar


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‘,

The website url I got this from no longer is there. I cannot confirm if still works.