Support

Account

Home Forums Add-ons Repeater Field Conditional Statement using Repeater in Option Page.

Solved

Conditional Statement using Repeater in Option Page.

  • Hi,

    I have a select field inside the repeater field in option page, i am trying to use conditional statement so if the select field value is horizontal it displays horizontal and if the select field value is vertical it displays vertical.

    Thank you.

  • Figured it out 😉

    <?php if( have_rows('optionpage', 'option') ): ?>
    <?php while( have_rows('optionpage', 'option') ): the_row(); ?>
    
    <?php 
    $layout_type = get_sub_field('page_layout');
    if ($layout_type == 'vertical'){
    echo 'vertical';}
    else {
    echo 'horizontal';}
     ?>
    <?php endwhile; ?>
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.