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?
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 🙂
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.