WordPress.org

Ready to get started?Download WordPress

Forums

Permalinks w/ parent category only (1 post)

  1. ryanve
    Member
    Posted 3 years ago #

    Is there a variable like %category& that gives just the parent category?

    I'm building a site for an art gallery and my category structure is something like:

    Artwork (parent)
    - Abstract (child)
    - Figurative (child)
    - Drawings (child)
    News (parent)
    ...

    I've set the custom permalink structure to:
    /%category%=%postname%

    which for a post in the Drawings category would deliver a url like:
    .../artwork/drawings=post-name

    But I really only want the parent category to be part of the url. Ideally I'd like them to be:
    .../artwork=post-name
    or
    .../news=post-name

    Of course it's possible to set the permalink structure to:
    /artwork=%postname%

    which would be fine except that then posts in News would appear as
    .../artwork=post-name
    rather than
    .../news=post-name

    Any ideas?

    --
    @ admin: I first tried to post this a few min. earlier in the same place (How To...) but with the title "Permalinks w/ parent %category% only" but the % sign made the post not accessible. Please delete that one and keep this one.

Topic Closed

This topic has been closed to new replies.

About this Topic