WordPress.org

Ready to get started?Download WordPress

Forums

Categories Not showing up (8 posts)

  1. amthomas
    Member
    Posted 5 years ago #

    I've working in 2.8 and although i've created several categories they exist in the Admin panel but do not show up on my blog. I have attempted to change the the code on the hide=true (to false) but that doesn't seem to work. Any other ideas and assistance would be appreciated.

    Thanks in advance.

    Anthony

  2. EMG
    Forum Volunteer
    Posted 5 years ago #

    The categories, to my knowledge, have to have a post categorized in them to show up.

    So if you have a category called 'fish' but you haven't posted any posts labeled as 'fish', then the category won't show up.

  3. amthomas
    Member
    Posted 5 years ago #

    Is there anyway to fix that or it is what it is?

  4. amthomas
    Member
    Posted 5 years ago #

    Does anyone have a fix or work around for Categories showing up even if their are no entries. I want to have all categories viewable regardless.

    Thanks in advance.

    Anthony

  5. foxtrot123
    Member
    Posted 5 years ago #

    This behavior is by default, and it's annoying: We should be able to establish and present site structure without content. Or, at a minimum allow WordPress to include on every category page that lacks content something like "No posts yet! Check back later!"

    I would love to see a work around or plugin to get around this.

  6. foxtrot123
    Member
    Posted 5 years ago #

    Found the fix!

    You need to edit a line in your theme's header.php file.

    1. In your WordPress admin panel, go to Appearance > Editor
    2. On the right, under Theme Files, select the "Header" link (for the header.php file)
    3. Do a search (CTRL+F) for "list_categories"
    4. You should come to a line that looks something like this:

    <?php wp_list_categories('title_li=&exclude=' . $GLOBALS[asides_id]) ?>

    (The stuff between the parentheses will vary by theme.)

    5. Add "&hide_empty=0" (without the quotes) right before the last apostrophe (the '). (Basically, between these apostrophes is where you can add arguments. Arguments are separated by ampersands (&).

    So in the above example, the edited line looks like:

    <?php wp_list_categories('title_li=&exclude=&hide_empty=0' . $GLOBALS[asides_id]) ?>

    6. Click Update File and check your website. All categories should now show, whether they have posts or not.

    Note: This may also add the dreaded "Uncategorized" category item. If you want to exclude that, find its category ID* (it's probably "1"), and edit the line so it includes "&exclude=1" (assuming 1 is the ID) like this:

    <?php wp_list_categories('title_li=&exclude=&hide_empty=0' . $GLOBALS[asides_id]) ?>

    * How to find the category ID: http://www.wprecipes.com/how-to-find-wordpress-category-id

    Also, this link lists all the arguments you can add to the wp_list_categories function. http://codex.wordpress.org/Template_Tags/wp_list_categories. For instance, the order_by argument allows you to customize the order in which the categories are displayed (e.g., you can sort them by their IDs to give you full control). By default, it looks like they're sorted alphabetically.

    Yeah!

  7. hncsys
    Member
    Posted 5 years ago #

    Hey

    foxtrot123

    You are a legend! - This has been puzzling me all night (Newbie)

    Thanks :-D

  8. jppl
    Member
    Posted 4 years ago #

    I have the same problem, but another came up. I do not have "list_categories" in my header.php
    I use following theme: http://wordspop.com/
    Any idea how can I fix Categories?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags