• Resolved southcast

    (@southcast)


    Just to let you know guys that I have searched the forum thoroughly to find a solution before making this post.
    What I want to achieve is echo/display on my category page ( on each of my category pages), a simple numerical value for the number of posts within that category. Something like the example given below :

    Posts in this category : 86

    I hope I was clear enough. Anybody up for suggesting me a code to achieve this please.
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try using:

    <p class="num-posts">Posts in this category : <?php echo $wp_query->max_num_pages;?></p>

    outside of the Loop in your theme’s category template file.

    Sorry – mistake. That should be $wp_query->found_posts. I’m trying to disentangle the variables from a function I wrote that did something very similar and I disentangled the wrong variable.

    add this in category.php of your theme:

    <?php echo $wp_query->found_posts; ?>
    Thread Starter southcast

    (@southcast)

    @esmi and @alchymyth. Thanks a million guys ! The solution was accurate and the response was blazing fast !! Marking it resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display the number of posts within each category page.’ is closed to new replies.