Support

Account

Home Forums Add-ons Repeater Field Repeater field with checkbox

Unread

Repeater field with checkbox

    • sam.jay

    • March 11, 2019 at 6:03 am

    Hi there, wondering if the bright minds out there can help me with a little bit of PHP!

    I am trying to use the repeater field with the checkbox – so very close but not quite working how I need it.

    Basically, I have a field for deals, and then a checkbox to display which day the deal is on. If the checkbox is checked, I would like to display the deal. Right now it shows all the deals regardless of the checkbox.

    Any help would be greatly appreciated as PHP is not my strong suit (but this is probably super easy for someone else) 🙂

    Thank you! Here’s my code so far:

    <?php if( have_rows(‘bites’) ): ?>
    <?php while( have_rows(‘bites’) ): the_row(); ?>

    <?php
    // vars
    $day = get_sub_field_object(‘day_available’);
    $deal = get_sub_field(‘deal_description’);
    ?>
    <?php if ( $day && in_array(“monday”, $day)) {
    echo $deal;
    }

    endwhile;

    else :

    // no rows found

    endif; ?>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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.