I’ll check that one out.
It looks as if it should work (it looks a little like my solution, but more complex). But my guess is that this one won’t work on a ‘Flexible Layout’, because you have to target the sub fields (rows > layouts > sub_fields) to get the correct content.
Say you have a Flexible layout by the name of ‘project_content’, and a row where the actual content goes into is called ‘content’ and the actual content has the field name ‘text’, you have to target that one as:
if( have_rows('project_content') ): while ( have_rows('project_content') ) : the_row(); if( get_row_layout() == 'content' ): $custom_content = get_sub_field( 'text', $post->ID ); endif; endwhile; endif;
(or something like that…)
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!