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:

    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>
    <?php } ?>

    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 🙂