WordPress.org

Support

Support » Themes and Templates » Category post count

Category post count

  • 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>
  • The topic ‘Category post count’ is closed to new replies.