Home › Forums › Add-ons › Options Page › Select specific repeater rows from an options page › Reply To: Select specific repeater rows from an options page
<?php
// displaying the values
$selection = get_field('service_select');
if (!empty($selections)) {
if (have_rows('services', 'options')) {
while (have_rows('services', 'options')) {
the_row();
$title = get_sub_field('service_title');
if (in_array($title == $selection)) {
// get the other sub fields after checking
// instead of getting values that may not be needed
$icon = get_sub_field('service_icon');
$title = get_sub_field('service_title');
$teaser = get_sub_field('service_teaser');
$description = get_sub_field('service_description');
$link = get_sub_field('service_link');
?>
<div class="callout" data-equalizer-watch="callout">
<img src="<?php echo $icon['url']; ?>" alt="<?php echo $icon['alt'] ?>" />
<h5 class="text-center"><?php echo $title ?></h5>
<p class="text-center"><?php echo $teaser ?></p>
</div>
<?php
} // end if selection is selected
} // end while have rows
} // end if get field
} // end if !empty
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF’s Repeater field is a versatile solution for repeating content in #WordPress.
— Advanced Custom Fields (@wp_acf) December 29, 2022
What’s your favorite use case for the Repeater field?
What’s the weirdest thing you’ve ever used it for?
Let us know!👇
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.