Support

Account

Home Forums Add-ons Flexible Content Field How to use flexible content field inside repeater use

Helping

How to use flexible content field inside repeater use

  • /*
    ACF Flexible content field name : experience_section
    1st text field name is : experience_top_short_description
    Repeater field name is: experience_section (Repeater inner field name is : experience_image, experience_title, experience_short_description)
    2nd text field name is : experience_bottom_short_description
    */

    <?php while(the_flexible_field(“experience_section”)): ?>
    <div class=”agent-info lg-col-12″>
    <div style=”padding: 78px 50px;text-align: justify;”>
    <div class=”agent-name”>Experience</div>
    <p class=”about-info”><?php echo the_field(‘experience_top_short_description’); ?></p>
    </div>
    </div>
    <!– Bottom Slider Start here –>
    <div class=”agent-info lg-col-12″>
    <?php if(get_field(‘presentation_slider_section’)): ?>
    <div class=”carousel” data-flickity='{ “freeScroll”: true, “wrapAround”: true }’>
    <?php while(has_sub_field(‘presentation_slider_section’)): ?>
    <div class=”carousel-cell” style=”width: 27%;”>
    “>
    <p>135 GRANDVIEW AVENUE IN GLENDALE</p>
    <p>The tile the master bathroom is a sight to see</p>
    </div>
    <?php endwhile; ?>
    </div>
    <?php endif; ?>
    </div>
    <!– Bottom Slider End here –>
    <div class=”agent-info lg-col-12″>
    <div style=”padding: 78px 50px;text-align: justify;”>
    <p class=”about-info”><?php echo the_field(‘experience_bottom_short_description’); ?></p>
    </div>
    </div>
    <?php endwhile; ?>

  • the_flexible_field() and has_sub_field() are deprecated. You should be using have_rows() https://www.advancedcustomfields.com/resources/have_rows/ for all repeater type fields, including flex fields.

    For all sub fields of repeaters you should be using get_sub_field() https://www.advancedcustomfields.com/resources/get_sub_field/ or the_sub_field() https://www.advancedcustomfields.com/resources/the_sub_field/ and not get_field() or the_field()

    have_rows() works on both top level fields and sub fields

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.