• Resolved christdg

    (@christdg)


    I created several groups of fields to use throughout my flexible content layouts.

    However I cannot call them in the template file as defined in the layout.

    So heres the setup

    Group – Title Repeater (titles_repeater)
    Repeater Fields
    – Title
    – Tag
    – Class

    Then I have a Flexible content field (flex_content) with a layout called “General Content Block”

    This layout has a clone field of the “Group – Title Repeater”
    with the name of (flex_general_content_block_titles)

    Then for this layout I have defined a template of “flex-content/components/base/general-content-block/flex_general_content_block.php”

    This file should create the front end html when using the call the_flexible(‘flex_content’);

    However I cannot get clone fields to render…I can get a text field to show up but all my cloned fields return NULL / false

    ive tried
    get_field(‘flex_general_content_block_titles’);
    get_flexible(‘flex_general_content_block_titles’);
    get_sub_field(‘flex_general_content_block_titles’);

    The above call return respectively
    NULL
    bool(false)
    bool(false)

    Is there a secret or setting I need to get access to the fields in the template file?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback and sorry for the late answer. It looks like you’re struggeling to use a clone inside a flexible content layout. The method does not differ from the native ACF way to achieve it, using the get_sub_field() function. You should check the Clone field documentation: https://www.advancedcustomfields.com/resources/clone/

    There is a code example for clones inside a flexbile content:

    if(have_rows('slides')){
        while(have_rows('slides')){ the_row();
            
            // Clone Button
            $button = get_sub_field('button');
        
        }
    }
    

    Considering this, when using the ACF Extended Flexible Content Dynamic Render, you can still use the_flexible('flex_content');, then in your layout.php file, use $button = get_sub_field('button').

    Hope it helps!

    Regards.

Viewing 1 replies (of 1 total)

The topic ‘Flex Content Layout using clone field not rendering’ is closed to new replies.