WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category of current archive AND parent category (4 posts)

  1. sugardaddy
    Member
    Posted 1 year ago #

    I'm trying to achieve something that sounds pretty easy to understand, but... whatever I do, it doesn't work. Let me explain it :

    In my archive template, I want to display the name of the current category. That's easy and I can do that.
    But I also want to display the parent category name, if there's one.
    And... I don't want to display the category name twice when the current category is a top level one.

    Thanks a lot for your help !

  2. esmi
    Forum Moderator
    Posted 1 year ago #

  3. sugardaddy
    Member
    Posted 1 year ago #

    I did... But if I use it with a separator, I get the separator after the last (current) category, and that's not pretty ;-)

    I need help because I tried many things before.

  4. sugardaddy
    Member
    Posted 1 year ago #

    Well... it gave me an idea and that did the trick !
    The separator is now wrap in a span and I hide it with css (last-child).

    Sometimes, we need to talk about problems to find the answer quicker.

    Thanks !

Topic Closed

This topic has been closed to new replies.

About this Topic