WordPress.org

Ready to get started?Download WordPress

Forums

Category post count (1 post)

  1. Mithrustt
    Member
    Posted 6 years ago #

    In my post archives section, on the right side, I have it so it says how many posts are in that category. The problem is, no matter how many posts there are actually in the category, it says "This category contains 2 posts." The issue being that the categories obviously have more than 2 posts.

    This is the code I have, maybe someone can see where the issue is:

    <div class="archive_number">
    
    This category contains <?php $cat = get_the_category(); $cat = $cat[0]; echo $cat->category_count; ?> posts
    
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic