Support

Account

Home Forums Add-ons Flexible Content Field Is it possible to use flexible content row layout field inside a repeater? Reply To: Is it possible to use flexible content row layout field inside a repeater?

  • Hi @glenn

    That’s because the repeater field doesn’t have a field with “card_style” as the name. If you want to get the layout value from inside the repeater field, you need to store it in a variable first. It should be something like this:

    if ( get_row_layout() == 'cards' ) :
        $cart_style = get_sub_field('card_style');
    
        if ( have_rows('card') ) :
            while ( have_rows('card') ) : the_row();
                if ( $cart_style === 'stacked' ) :
                    echo '<article class="card card--stacked">';
                else :
                    echo '<article class="card">';
                endif;
            endwhile; endif;
        endif;
    
    endif;

    I hope this makes sense 🙂