ACF – new flexible content layout not displaying on front-end

enter image description here

I have added a new layout to a flexible content block, but for some reason it isn’t displaying on the page as it should. Previous layouts that have been created are displaying fine and the layout I have created is showing up in the back-end as it should.

Here is the code for my index.php page:

<?php get_header(); ?>

<?php if(have_posts()){

while(have_posts()){
    the_post();
    $header_type = get_field( 'header_type' );
    get_template_part('templates/header', $header_type);
    if(have_rows('flexible_content')){
        while(have_rows('flexible_content')){
            the_row();
            $layout = get_row_layout();
            get_template_part('templates/flex', $layout);
        }
    }
}
} ?>

<?php get_footer();  ?>

and here is the code for my layout:

<div class="full-width-image-block" style="background-image:url(<?php if( get_sub_field( 'full-width-image' ) ){ the_sub_field( 'full-width-image' ); } ?>) ;">
<div class="page-width">
    <?php if( get_sub_field( 'heading' ) ){ ?>
        <p class="large-text"><?php the_sub_field( 'heading' ); ?></p>
    <?php } ?>
</div>

The layout template is named “flex-full-width-image-block” so it should be picked up correctly, but I can’t seem to work out why its not displaying.

FYI, max_vars is set to 3000. Any help appreciated. Thanks in advance.

Read more here:: ACF – new flexible content layout not displaying on front-end

Leave a Reply

Your email address will not be published. Required fields are marked *