How to display multiple values from custom fields in text block?

  • I created a CPT called “Recordings” with a few custom fields, such as “genre” using checkboxes and “location” using radio buttons.

    In the Query Block, I’d like to display all values assigned to a Recordings post. However, when I add {{post_meta key:genre}} to a text block inside the Loop Item block, it only displays one value, even when multiple values are selected for that post.

    How can I resolve this?

  • Hi there,

    The Checkbox field returns an array, so you’ll need to use a nested Query block with the Post Meta query type and set the Meta Key to genre.

    Then inside the Loop Item block, add a Text block and set its content to use the {{loop_item}} dynamic tag.

  • Thanks, but I’m still not quite getting it.

    When I change the query block type from “Post Query” to “Post Meta”, I don’t see a way to select the “Recordings” CPT for the query. Screenshot.

    Also, I can’t seem to apply the “genre” meta key.

    I assume there are a few additional steps required to achieve the desired result?

    Kind regards
    Sascha

  • You need to nest the Post Meta Query block inside the main Post Query block, like this:
    https://cln.sh/fPkkkGJnW9Hwy0169lQ3

    If the genre meta key is not listed in the Meta Key dropdown, you can manually type genre into the field and click Add.

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