Post Object value into Query Grid

  • birdhousedigital

    Hi,
    I have a Post Object field linking my products/artworks to their artist. I want this value (artist’s name) to show when I’m using the generate press query block. It doesn’t work by using Text > Dynamic Value > Post Meta. How do I do this?

    Many thanks.

  • Hi there,

    Would it be possible for you to provide a temporary admin login so we can take a closer look at your setup?

  • birdhousedigital

    Of course – temporary login details in the Private Information area.

  • Hi,

    Text > Dynamic Value > Post Meta doesn’t work for product_artist because it’s an ACF Post Object field, which stores the linked artist as a post ID rather than text. The Post Meta dynamic tag can’t turn that ID into the artist’s name, so nothing displays.

    You can solve this without any code by nesting a second Query Loop, using the same Post Meta technique you already used for the artworks.

    Inside your Loop Item (the one rendering each product), add a new GenerateBlocks Query Loop with these settings:

    • Query Type: Post Meta
    • Meta Key: product_artist

    Then inside that inner loop’s Loop Item, add a Text block and set a Title dynamic tag. If you want the artist names linked, set the Text block’s dynamic link to the post permalink.

    This works because the Post Meta query type treats each stored artist ID as a post, so the post title gives you the artist’s name. It handles products with multiple artists automatically too.

  • birdhousedigital

    Thanks – I can see that works but doesn’t output the result on the front end. I’m guessing this is because the original query is a Post Meta Query for products selected using an AFC field for that event, and the double Post Meta Query doesn’t work?

  • I’m guessing this is because the original query is a Post Meta Query for products selected using an AFC field for that event, and the double Post Meta Query doesn’t work?

    That could be the reason. For a typical setup like this, the parent Query block usually needs to use the Post query type. That allows the nested Query block to inherit the correct post context from the parent query and retrieve the intended meta information.

    In this specific case, you may only need to add the artist name as static text, since all the artwork belongs to the same artist anyway.

  • birdhousedigital

    Thanks for your help. Many of our exhibitions have multiple artists so I will look for another way to pull in specific products and then use the Post Meta query to show the artist’s names.

  • Sure, no problem. 🙂

    Just an idea: if it’s possible, you could add the Artist name as a Product Attribute. That would allow it to be fetched directly within the Query block using the appropriate meta key, which may simplify the setup.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.