List Categories In Order Of Hierarchy

Community Forums Forums Design Tips and Tricks List Categories In Order Of Hierarchy

This topic is: resolved

This topic contains 3 replies, has 2 voices, and was last updated by  Lauren @ OnceCoupled 2 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #117020

    chad1008
    Member
    Post count: 6

    Hello all!

    I was wondering if anyone had any insight on how to modify post meta to list categories (or custom terms to be more specific) in order of their parent/child relationships – as opposed to a simple alphabetical list.

    Example:

    A pet blog with a post listed under the following categories: “Dogs,” “Small Breeds,” & “Chihuahua.” Dog is the main category. Small Breeds is a child category under Dogs, and Chihuahua is a third level category under Small Breeds.

    The post meta for this would read “Filed Under: Chihuahua, Dogs, Small Breeds.” (alphabetical)

    How would I go about listing them based on parent/child relationships? (“Filed Under: Dogs, Small Breeds, Chihuahua”)

    Thanks in advance!

    • This topic was modified 2 months, 3 weeks ago by  chad1008. Reason: Typo
    • This topic was modified 2 months, 3 weeks ago by  chad1008. Reason: Typo
    #117023

    Lauren @ OnceCoupled
    Member
    Post count: 611

    Hey, I’m not sure what your level of WordPress customization is?

    When you call the list of categories (http://codex.wordpress.org/Function_Reference/wp_get_post_categories) you should use the args array to specify your “orderby” as “parent” (http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters).

    To change the post meta, use this function, but skip the shortcodes so you can use the function above:
    http://my.studiopress.com/snippets/entry-footer/#customize


    I do custom WordPress work! http://oncecoupled.com
    Contact me directly: lauren@oncecoupled.com

    #117030

    chad1008
    Member
    Post count: 6

    ugh. Let’s just say my level of customization is such that I should have known better. ;)

    I seem to have a developed a bad habit of looking so hard at Genesis and it’s handy hooks and snippets that I completely overlook basic WordPress functions I’ve been using for years.

    Thanks Lauren!

    #117062

    Lauren @ OnceCoupled
    Member
    Post count: 611

    That’s the best part of collaboration, right? We get each other out of our thinking circles!


    I do custom WordPress work! http://oncecoupled.com
    Contact me directly: lauren@oncecoupled.com

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘List Categories In Order Of Hierarchy’ is closed to new replies.