Support

Account

Home Forums Add-ons Repeater Field Flexible content within repeater within repeater

Solved

Flexible content within repeater within repeater

  • Hi just want to know if its possible to have a nested repeater field and flexible content. I mean 3 level while loop.

    ex.
    repeater 1
    >> repeater 2
    >>> flexible content.

    actual code:

    function get_nested_loop(){
        if(function_exists('get_field') && function_exists('get_sub_field')){
            if(get_field('repeater_1','options')){
                while(has_sub_field('repeater_1','options')){
                    echo '<br/>'.get_sub_field('test_field','options');
                    if(get_sub_field('repeater_2','options')){
                        while(has_sub_field('repeater_2','options')){
                            echo '<br/>'.get_sub_field('test_field_2','options');
                            if(get_sub_field('flexible_3','options')){
                                while(has_sub_field('flexible_3','options')){
                                    echo '<br/>while 3';
                                    if(get_row_layout() == 'layout_1'){
                                        echo '<br/>'.get_sub_field('layout_content_1','options');
                                    }elseif(get_row_layout() == 'layout_2'){
                                        echo '<br/>'.get_sub_field('layout_content_2','options');
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    add_action('wp_head', 'get_nested_loop');

    Output.

    Testing 1
    Testing 1 1
    while 3
    
    Testing 1 2
    while 3
    - 
    Testing 2
    Testing 2 1
    while 3

    Hope to hear if anyone has an idea.

    Thanks

  • Ignore this already been fixed.

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

The topic ‘Flexible content within repeater within repeater’ is closed to new replies.