Passing data into variables for IF or filter

Hi Chris, since you’re trying to loop through a custom post type and filter that query based on a particular field, you should be able to do that by using the query parameters that are available for post loops. Assuming the data in your custom field is just a text string, you should be able to write something like this so that when you place this markup on a page from dataset1 that has a “reference” field, it only shows posts that have a matching “reference” field from dataset2.

<Loop type=dataset2 custom_field=reference custom_field_value="{Field reference}">
  Fields you want to display from dataset2.

You might find this forum post from Eliot useful in understanding the different ways to filter the items in a query. I’ll probably eventually either make a blog post about that and/or add details to the docs, but I figured I’d share that with you for now in case that’s helpful.

1 Like