• so i’ve got a photoblog and all the parent/child categories are arranged by location. my categories look something like this:

    >Canada
    >>Vancouver
    >>Toronto
    >USA
    >>Chicago
    >>Los Angeles

    when i post a photo, i’d like the category for the post to be displayed as

    CITY, COUNTRY aka CHILD, PARENT

    but right now it displays in alphabetical order regardless of hierarchy (Canada, Vancouver).

    is there any way i can lock the category display in reverse hierarchical order?

    my photoblog: https://www.ivanlo.com/photo/

Viewing 2 replies - 1 through 2 (of 2 total)
  • You could try using get_the_category() instead of the_category() then reverse (or otherwise sort) the array before echoing it out as category links.

    https://codex.www.ads-software.com/Function_Reference/get_the_category

    Thread Starter ivanlo

    (@ivanlo)

    thanks for the suggestion, esmi. could you give me an example of how the code would look? i tried it out but i could only display the category ID’s and not the individual names (when i used the variable cat_name it displayed both parent and child categories in alphabetical order).

    maybe i did something wrong? i’m a photographer, not a coder ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘reverse hierarchy of parent/child categories for individual posts’ is closed to new replies.