WordPress.org

Support

Support » Themes and Templates » [Resolved] How to Show Empty Categories !!?

[Resolved] How to Show Empty Categories !!?

  • Hello

    I have searched for this but no luck. Im new here and this is my first serios blog so I need to get everything right before launching it.

    Empty Categories don’t show up in the sidebar, how to change this ?

    What file do I need to modify and with what code ?

    Edit: Also, how to show categories according to ID’s and not titles 🙂

    Thank You.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You’ll need the hide_empty parameter for the template tag, wp_list_categories.

    An example of this is the WordPress Default 1.6 Theme where wp-content/themes/default/sidebar has this code

    <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>

    you would change to this code:

    <?php wp_list_categories('hide_empty=0&show_count=1&title_li=<h2>Categories</h2>'); ?>

    Also see:
    Stepping into Templates
    Stepping into Template Tags
    Template Hierarchy

    Thanks a million. Its working.

    Do you happen to know how to have categories listed in the sidebar according to ID’s 🙂

    Thank You.

    it does that by default.

    He provided several links that explain all of that for you.

    I did not notice the links he provided, just grapped the code and ran to try it 🙂

    To sort categories by id and show empty one’s at the same time:

    <?php wp_list_categories(‘orderby=id&hide_empty=0&show_count=1&title_li=<h2>Categories</h2>’); ?>

    Thank You 🙂

    Excellent thread, helped me out while i was searching for the same on other blogs.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] How to Show Empty Categories !!?’ is closed to new replies.
Skip to toolbar