WordPress.org

Ready to get started?Download WordPress

Forums

Show Top Level Categories Only (6 posts)

  1. urbanmac
    Member
    Posted 9 years ago #

    I have a site I'm building with 5 top level categories, each of these categories has a number of sub-categories. I want the category list just to show the 5 top level categories only and not list the sub categories and I'm stuck on what tag to use....any help much appreciated :)

    Thanks

  2. NuclearMoose
    Member
    Posted 9 years ago #

    I used your post title and a Google search on site:wordpress.org and came up with this list of threads you may find helpful:
    http://tinyurl.com/6bh7w

  3. urbanmac
    Member
    Posted 9 years ago #

    Thanks for the link (I never knew you could do that in google!)

    I've read through a number of postings and I still cant find what I'm after.

  4. RustIndy
    Member
    Posted 9 years ago #

    Locate the wp_list_cats command in your "index.php" file (or whichever file shows the thing - in v1.5 it'll be in the "sidebar.php" file instead) and add the command children=0 to it.

    For example, it might look like this:
    <?php wp_list_cats('children=0'); ?>

    That'll show only the main categories.

  5. urbanmac
    Member
    Posted 9 years ago #

    I'll give it ago - Thank you :)

  6. urbanmac
    Member
    Posted 9 years ago #

    Thats not working for me - its still showing the sub catagories but has moved them to the same level in the bulleted list

    before:
    * cat 1
    * cat 2
       * sub cat
    *cat 3

    after:
    * cat 1
    * cat 2
    * sub cat
    *cat 3

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.