Home › Forums › Add-ons › Flexible Content Field › Flexible Content Displaying Zero's & Limited Fields
Hello, love this plugin! I purchased the “Flexible Content” Add-On and I’ve got 2 problems that I’m hoping someone out there can help me solve.
1) Display Zero’s
My clients site needs to display zero’s if entered into the field, but if we enter “0” it doesn’t display on the front end. I know it’s because of the get_sub_field if statement that it’s not showing, and I also know that I can get it to work if I add !== false to the code, however, that makes it so empty items show up when there is no content. I need it to work like this…if the field is empty, don’t show it, if the field has content (any content including zero’s) show it. That’s it. Here’s the basic function I”m using:
// Sand Equivalent
if( get_row_layout() == 'sand_equivalent' ):
if( get_sub_field('sand_equivalent-data') !== false):
echo '<tr class="row row-section">';
echo '<td class="column-1">D2419</td>';
echo '<td class="column-2">T176</td>';
echo '<td class="column-3"><strong>Sand Equivalent</strong></td>';
echo '<td class="column-4">Sand Equivalent</td>';
echo '<td class="column-5">' . get_sub_field('sand_equivalent-data') . ' </td>';
echo '</tr>';
endif;
endif;
2) Limited Fields with Flexible Content
In my flexible content field, I have about 15 layout rows each having about 3-4 sub-fields. I need to have 19 layout rows, however the flexible fields won’t allow me to add more. I’ve read on these forums these helpful posts:
I’ve tried the php.ini and the .htaccess solutions, as well as bumping the memory_limit and non of those fixed the issue. So my questions are:
Thanks for your time and help today!
I am noticing a similar issue (#2) as well for limiting fields. Haven’t narrowed down the cause yet, but I have 9 layouts, each with 1-4 sub-fields. When I add more than 9, the new layouts do not get saved in the db, and a few PHP Notices are thrown (debug.log):
PHP Notice: Undefined index: rules in …
PHP Notice: Undefined index: allorany in …
Additionally, the custom button name I use (“Add Page Section”) changes back to “Add Row”
Not sure where to look to fix this bug.
The topic ‘Flexible Content Displaying Zero's & Limited Fields’ is closed to new replies.
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.