WordPress.org

Ready to get started?Download WordPress

Forums

How to show Posts in Child Taxonomy or current post (3 posts)

  1. TheDuke13
    Member
    Posted 2 years ago #

    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:
    Furniture
    -Spa Tables
    -- Spa Table Accessories
    - Chairs
    Equipment
    - 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.

    Thanks!

    Carl TheDuke

  2. President McCheese
    Member
    Posted 2 years ago #

  3. TheDuke13
    Member
    Posted 2 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.