Home › Forums › Add-ons › Repeater Field › If sub field has value 'x' then do this… › Reply To: If sub field has value 'x' then do this…
Hi Brad, if the values in the “description” dropdown already match your CSS classes (for ease, it would be good if they did), then can you just do something like this:
<ul>
<?php
while( the_repeater_field(thp_coach) ) {
?>
<li class=”thp-member <?php the_sub_field('description'); ?>”>
<img src=”<?php the_sub_field('photo'); ? />”>
<h4><?php the_sub_field('name'); ?></h4>
<p><?php the_sub_field('description'); ?></p>
</li>
<?php } ?>
</ul>
Basically just adding the “description” dropdown value as a class to the <li>
.
You’d then just end up with something like:
<li class="thp-member gold"></li>
No ‘if’ statement required 🙂
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.