Support » Plugins » Hacks » Show some categories based on number of posts

  • Hi everyone, this is my first question here. I am a little lost, because what I am trying to achieve in my site is to show on the sidebar only certains categories, based on the numbers of post in that specific category (no entry is posted in more the one category). For instance, I would like to be able to show only categories that have at least 10 post.

    I’ve searched and founded this thread:, but:

    1) is an old one
    2) doesn’t really fit me, as only refers on how to exclude categories based on ID
    3) I have a vague idea of php, so I guess what I’ll need would be a tutorial or something similar

    Can any of you suggest me some resource where I can find a clue or give me some tips on how to achieve this?

    Thank you in advance for your time, and as we are close… happy new year!

    Cheers from Spain!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    I don’t know of a step by step, but hopefully this will help. You want to use get categories. See if you can do something with the examples, in particular the one that lists categories with descriptions. It also lists the post counts for each category.

    You variant of this would simply only echo out the html for any category if the $category->count > 9, something like

      foreach($categories as $category) {
        if ($category->count > 9) {
          //echo stuff as in example

Viewing 1 replies (of 1 total)
  • The topic ‘Show some categories based on number of posts’ is closed to new replies.