I’m looking for a way to use a shortcode for a repeater field. I’m using this on a product category page and I want to use a shortcode that will display the appropriate row but using a match attribute. Example:
[acf_repeater field=”{$repeater_name}” match_field=”{$sub_field_name}” match=”Bobby”]
Name: [field_name=”player_name”]
Position: [field_name=”player_position”]
Jersey Number: [field_name=”player_number”]
[/acf_repeater]
This would loop through the repeater field, find the sub field that matches, then we’d be in that sub field and we can output the fields from that row ID (since we don’t always know the row ID, we just need to match a value in one of the row’s subfields).
Anybody do anything like this already?
Thanks in advance.
There is nothing specific to this. You would need to build your own shortcode. This is a good place to start https://developer.wordpress.org/reference/functions/add_shortcode/