Home › Forums › Add-ons › Flexible Content Field › Can only output 6 layouts from my Flexible Content field
Hi,
I’m using ACF Pro Version 6.0.5 with WP 6.1. I have a Flexible Content field with 6 layouts in it. They display fine on the front end. When I create a 7th layout in the field I just can’t get that layout to display. It’s like I’ve reached a limit.
If I try and just display that 7th layout and not display layouts 1-6 it displays.
Go figure. 2 of the layouts use basic Repeaters if it matters.
I did see 1 issue in my php-fpm-error.log “server reached max_children setting (4), consider raising it”
I’m hosted on Pantheon with these setting in php.ini
with max_execution_time = 120
max_input_time = 900
max_input_vars = 10000
memory_limit = 256M
Any help appreciated!
Thanks
My code is a series of if statements in a while loop. I’m not using any elseif
<?php if( have_rows('universal') ): ?>
<?php while( have_rows('universal') ): the_row(); ?>
<?php if( get_row_layout() == 'text' ): ?>
//output
<?php endif; ?>
<?php if( get_row_layout() == 'cards' ): ?>
//output
<?php endif; ?>
+ 6 more of these each querying a different layout
<?php endwhile; ?>
<?php endif; ?>
Found the issue. I was trying to call WP posts in a <?php elseif( get_row_layout() == 'featured_news' ): ?>
<?php
$tags = get_sub_field('tags');
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'tag' => $tags,
'posts_per_page' => 5,
);
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
...output
<?php
endwhile;
endif;
?>
but needed to have wp_reset_postdata();
at the bottom like:
<?php
$tags = get_sub_field('tags');
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'tag' => $tags,
'posts_per_page' => 5,
);
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
...output
<?php
endwhile;
wp_reset_postdata(); <=NEEDED THIS
endif;
?>
May help someone else
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.