Support » Fixing WordPress » Post categories display

  • I’m new to wordpress but trying to migrate over from Drupal (I’ll just leave that there)!!

    In a nutshell I’m trying to build a site which has custom posts (basically products but with no e-commerce solution).

    It’s the template hierarchy I’m struggling with.

    Custom post type: Evening Wear

    Categories: Dinner Suits, Bow Ties, Waistcoats

    All simple so far, but here’s the user journey part I can’t figure out

    Navigate to ‘Evening Wear’ => display child categories
    Click a child category (Suits) => display Suits (posts)

    It’s basically the two lines above I can’t figure out, I have made an archive page which gets the posts (archive-evening_hire.blade.php), so when I navigate to /evening-hire I get the posts not the categories.

    I’ve been searching for hours to find a tutorial but can’t seem to find anything, I don’t expect anyone to write the whole thing out for me but could someone please point me to a tutorial that might help me figure this out?

    I’m using starter theme Sage 9

    i know I could have done this in drupal in 30 minutes but I’m determined to try and snagg it in WordPress.

    thanks very much.

    • This topic was modified 1 year, 5 months ago by  barrypoore.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey Barry,
    You should be able to get away with using the code in this gist (https://gist.github.com/mpeshev/cb1cd3c56d06017b3d87) in archive-[taxonomy-name].php (where [taxonomy-name] is replaced by whatever the slug of your taxonomy is).

    The important part is the
    if( $category['parent'] === '0' ) {
    which checks to see if the category is top level – and shows the child categories if it is.

    Hopefully that should get you on the right path

    Ah top man that’s the exact sort of thing I’m looking for, yes that makes good sense, thanks a lot 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post categories display’ is closed to new replies.