Get specific repeater row (via advanced custom fields) based on Meta Query with Wildcards [closed]

I’ve used Example 5 of: http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/ to query a post by a wildcard. However, my problem is I only want to display the row (from the repeater field) which is the same number as the wildcard within the meta query.
To give this more context, here’s a brief example.

I have a meta query that’s getting the availability of a property by the ‘week’ field, which is brought through via a form and $_POST data. For the example I’ve hard coded the value.

$search_args = array(
    'numberposts' => -1,
    'post_type' => 'property',
    'meta_query' => array(
        array(
            'key' => 'availability_%_week',
            'value' => '20140607',
            'compare' => '='
        )
    )
);

I need to find what the number of the Wildcard is so I can then use it to get the specific row.

Any help would be greatly appreciated.

1 Answer
1

Assuming that you will have a loop to display the results of the query, you could loop through the repeater at that point and display only the row that has the correct value.

Leave a Comment