Home › Forums › Add-ons › Flexible Content Field › Store single layout's content & load on another page › Reply To: Store single layout's content & load on another page
My use of flex fields in likely rather different than others. I have a function similar to:
functions do_layouts($post_id=false) {
if (!$post_id) {
// call function or figure out post id to use
}
if (have_rows('flex-field', $post_id) {
while (have_rows('flex-field, $post_id) {
the_row();
$layout = get_row_layout();
switch($layout) {
// ...
case 'global-panel':
$gp = get_field('post-object', false, false); // ID only
if ($gp) {
do_layouts($gp);
}
break;
// ...
default:
get_template_part('template-parts/layouts/'.$gp);
break;
} // end switch
} // end whild
} // end if
}
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.