Support » Fixing WordPress » How to show Posts in Child Taxonomy or current post

  • Hi All,

    I’ve been looking around trying to find a solution or snippet of code I could adapt to my purpose… as usual when you’re looking for it you can’t find id… Murphys law.

    So here’s what we have:

    1 Custom post Type “Products”
    With custom taxonomy that looks like this:
    Product Categories:
    -Spa Tables
    — Spa Table Accessories
    – Chairs
    – Wax warmers
    – Magnifying Lamps
    — Magnifying Lamp Accessories

    Here’s What I’m trying to do:

    On a specific product (single-product.php), I’m looking to display “related products”
    ex: ‘Spa Bed’ is a product in ‘Spa Tables’, I’m trying to display all posts that are in the child ‘Spa Table Accessories’

    This would need to be either automatic based on if the current post taxonomy, display all posts in the taxonomy’s child taxonomy. Or a conditional function that goes like this: IF ‘Product’ is in ‘Spa Tables’ THEN display all posts from ‘Spa Table Accessories’ … I understand this would mean creating a snippet for each ‘Product Category’ that has a decendant…. but i’m ok with that.

    If anyone could help me with this that would be great.


    Carl TheDuke

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Jason, Thanks for the reference, I had been experimenting with this, I can get it to show all posts from the ‘Spa Table Accessories’ the part where I’m having difficulty is trying to get the conditional based on the current post ….
    with the link you provided I am able to show all posts from a taxonomy,
    How would I go about getting that taxonomy?

    I guess what I’m missing is how to code the following:
    ‘Y’ = find taxonomy of product ‘A’
    ‘Z’ = find child of ‘Y’

    Then I would query for all posts in taxonomy ‘Z’

    Any chance you could help with that part?

    Thanks Again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to show Posts in Child Taxonomy or current post’ is closed to new replies.