• Resolved rose18

    (@rose18)


    Hi there,

    This is a great plugin!
    I am following this documentation (https://www.acf-extended.com/features/fields/flexible-content/dynamic-render), but I am kind of confused regarding the Front-End Render the_flexible(), has_flexible() & get_flexible() functions.
    How do I switch from my current code to using these new functions?

    I am currently using this code (see below):

    if( have_rows('sp_modules') ):
         // loop through the rows of data
        while ( have_rows('sp_modules') ) : the_row();
            if( get_row_layout() == 'text_block' ):
                get_template_part( 'modules/module', 'text-block' );
            elseif( get_row_layout() == 'split_image_block' ):
                get_template_part( 'modules/module', 'split-image-block' );
            elseif( get_row_layout() == 'column_cards' ):
                get_template_part( 'modules/module', 'column-cards' );
            endif;
        endwhile;
    else :
        // no layouts found
    endif;

    ‘sp_modules’ is the flexible content field name, and all the template files are in the ‘modules’ folder.

    How do I replace my current code with the new functions the_flexible(), has_flexible() & get_flexible()?

    Thanks!

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

    (@hwk-fr)

    Hello,

    Thanks for the feedback! I’m glad you enjoy ACF Extended!

    As explained in the documentation, you can simply enable the “Dynamic Render” setting in your Flexible Content field and then add your templates files paths in each layouts settings: modules/module/text-block.php, modules/module/split-image-block.php etc…

    Then on the front-end, you can replace your code with:

    if(has_flexible('sp_modules')):
        the_flexible('sp_modules');
    endif;
    

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Flexible Content Dynamic Render confusion’ is closed to new replies.