Home › Forums › Add-ons › Flexible Content Field › Flexible Content not rendering on frontend › Reply To: Flexible Content not rendering on frontend
You cannot combine
get_field('repeater || group || flexible conentent')
and
have_rows()
when dealing with sub field of any kind.
Everything is in the returned array here
$relevant = get_field('relevant');
and you must deal with looping over that array
$content_boxes = $relevant['content_boxes']
$content_rows = $content_boxes['content'];
foreach ($content_rows as $content) {
if ($content['acf_layout'] == 'new_article') {
$title = $content['article_title'];
}
}
Or you must start with and use have_rows() throughout
if (have_rows('relevant')) {
while (have_rows('relevant')) {
the_row();
if (have_rows('content_boxes')) {
while (have_rows('content_boxes')) {
the_row();
if (have_rows('content')) {
while (have_rows('content')) {
the_row();
}
}
}
}
}
}
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.