The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Hierarchical Category Display (6 posts)

  1. greg
    Posted 11 years ago #

    Hi all, hope somebody can help. Thanks in advance.

    I would like to display under each of my posts a hierarchy of locations, I'm using categories and child categories to record the location.

    Imagine this, I choose all the following categories to record my location in a travelogue:

    -State: Minnesota
    ---County: Hennepin
    ------City: Minneapolis
    -State: Wisconsin
    ---County: Dane
    ------City: Madison

    Does anybody know a good way to set up my category listing to display this with this sort of hierarchical layout.

    Sorry for the kind of incoherent description, like I said, I hope someone can help.


  2. groovenectar
    Posted 11 years ago #

    try opening your sidebar template... find where it has the function list_cats(...)

    remove or comment out that function, and replace it with:

  3. greg
    Posted 11 years ago #

    Wow, well that's beautiful, thank you!

    I was actually hoping to figure out how to do that within the posts themselves, too. To show the locations referred to in each original post... Basically modifying 'the_category' tag, I think.

    Does that make sense?

    Many, many thanks!

  4. Kafkaesqui

    Posted 11 years ago #

    greg: Look at the 'parents' parameter for the_category():


  5. greg
    Posted 11 years ago #

    UPDATE: scratch this, I'm a moron. All my problems are fixed, thanks again for all the help!

    Again, thank you. That one seems pretty obvious. As a WP newbie, I'm still pretty thrown off by the jargon sometimes and I miss the obvious. One (hopefully final) question:

    I implemented this with 'single' and I now get this for posts with parent categories:


    Preferably, I'd just like to have


    Each term would be a link to the category. Make sense? Possible?

    Thanks for the patient help.

  6. Kafkaesqui

    Posted 11 years ago #

    greg: For what you're trying to do, I think your best option is to use 'multiple' for the 'parent' parameter, and then make sure to select only the child category for a post. Unless you're doing some custom filtering through your templates, WordPress lists posts in a child category under the parent category as well, by default.

Topic Closed

This topic has been closed to new replies.

About this Topic