Support

Account

Home Forums Add-ons Repeater Field How can i do this with subfields of subfields

Solved

How can i do this with subfields of subfields

  • I am having a tough time trying to figure out get the field if the row i need is a subfield of a subfield. So far I have this and it works fine for the most part except when I get to the subfield of subfield repeater

    <?php
    // check if the repeater field has rows of data
    if( have_rows(‘pricing_table’ , ‘option’) ):
    // loop through the rows of data
    while ( have_rows(‘pricing_table’ , ‘option’) ) : the_row();
    ?>
    <div class=”col-md-4 “>
    <div class=’package’>
    <div class=’name’><?php the_sub_field(‘title’,’option’); ?> </div>
    <div class=’price’><?php the_sub_field(‘price’,’option’);?>
    </div>
    <div class=’description’>
    <?php the_sub_field(‘description’,’option’);?>
    </div>

    The end result is something like this and this works
    the title
    $300.00 price
    a bit about the item

    Those are subfields to one repeater, In the same repeater I have another repeater for more info to be added as a ul/li list. The repeater is called “options” it should display 2 items as subfields like this but it wont work

    <div class=’glyphicons’>
    <?php the_sub_field(‘glyphicon’,’option’);?>
    </div>

    <div class=’listitems’>
    <?php the_sub_field(‘listitem’,’option’);?>
    </div>
    The end result is something like this and this works
    the title
    $300.00 price
    a bit about the item
    glyph hardwood
    glyph dye colored
    glyph hand sanded
    glyph coreholed
    ect, ect, ect
    So i am not sure how to write the sub-sub fields in this manner to get them to display. Can this be done ?

  • Hi @jamesg371

    For nested repeater, please take a look at this page: https://www.advancedcustomfields.com/resources/working-with-nested-repeaters/.

    I hope this helps 🙂

  • Thanks James, worked perfectly! Dont know why I didn’t find that before

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

You must be logged in to reply to this topic.