Support

Account

Home Forums Front-end Issues Relationship query – if related posts equals xxx

Solved

Relationship query – if related posts equals xxx

  • Hi there,
    does anybody know how to do this?

    I have two post types that are connected through a ACF relationship.
    “design” (parent post) + “item” (child post)

    There are:
    • 4 x “design”
    • 12 x “item”

    On every “design” post page, there are 12 divs (one for every “item”). I want the items that are related to a certain design to be highlighted, the other ones to be kept as they are.

    Does anyone know how to do this kind of query?

    Many thanks in advance!

  • Ok, so I solved this myself. Not in a beautiful way, but it works. I have 12 if functions to check which item(s) the design includes, like <?php if (get_the_title($design->ID) == "1001"){ do something } ?>

    If you have a shorter solution, I’m open to change the code!
    🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.