Forums

[resolved] Conditional to check whether category has posts (3 posts)

  1. ewergreen
    Member
    Posted 12 months ago #

    Can anyone tell me how to check whether a category has posts? I'm making a custom category view and would only like to display a link on the categories that have posts in them. Thanks!

  2. alchymyth
    The Sweeper
    Posted 12 months ago #

    one posibility:

    get_category($cat_id)->count

    http://codex.wordpress.org/Function_Reference/get_category

  3. ewergreen
    Member
    Posted 12 months ago #

    Thanks, that solved it.

Reply

You must log in to post.

About this Topic