How to show Posts in Child Taxonomy or current post
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:
— Spa Table Accessories
– 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.
- The topic ‘How to show Posts in Child Taxonomy or current post’ is closed to new replies.