• Hi,

    I’ve been searching for weeks all over the internet to find a solution to my question. I tried plugins, snippets, functions… everything I found. But I don’t know if I messed up somewhere and didn’t understand how to use some of them or if they simply don’t work.

    So here is my issue.
    I have many categories, and each of them has a child category (I don’t go deeper, I use tags).
    On my archive pages and posts, I get the terms, and I’d like to display them in hierarchical order because right now, for example, if I go to, let’s say, Films > Avengers [ redundant link removed ], it displays “Avengers, Films” and I want “Films, Avengers”, Films being the parent category, Avengers being the child category.

    Can someone help me achieve that?
    It has to be dynamic since the archive pages are created automatically or at least I could list the parent categories but not the child categories, there are too many of them.
    Thank you!

    • This topic was modified 3 years, 9 months ago by vinem.
    • This topic was modified 3 years, 9 months ago by vinem.
    • This topic was modified 3 years, 9 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter vinem

    (@vinem)

    Thx for the links. Problem is, I already saw them and I use a page builder. I can change some CSS but I don’t code. I don’t know what to do with what you gave me, that’s why I was asking for help.
    They say it has to be put in a loop. I don’t know how to do that.

    Oh, I posted this back to you bc you had mentioned that you used snippets and functions. So I had assumed you were open to that approach.
    It is very easy to do based on the WordPress file hierarchy :
    https://www.wpbeginner.com/wp-themes/create-custom-single-post-templates-for-specific-posts-or-sections-in-wordpress/

    If you use a page builder, then I would recommend asking in their support group.

    If the page builder does not have access to the portion of the page you are refering to, then you will either have to use a function in your template in your child theme as described above, or you will have to convert the page template to a page that is edittable by your page builder.

    Thread Starter vinem

    (@vinem)

    Yep, I’m open to it, I understand how it works, globally, I know I have to put part of the code in function.php then call it from the template I want it to be displayed in, like archive.php or other but I don’t know how to code an entire function from scratch.
    I can copy/paste and make some slight changes if I have to but that’s it.

    I think my page builder is not the problem because I found a function to display the tags by category when on an archive page using a box “tag cloud by category” and it works fine so I’d assume my page builder loads the function I add to my child theme.
    I created an archive template and a post template especially for this part of my website (it’s a Gallery system).

    I’m gonna take a look at your link. Thank you!

    • This reply was modified 3 years, 9 months ago by vinem.
    • This reply was modified 3 years, 9 months ago by vinem.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display categories in hierarchical order’ is closed to new replies.