Home › Forums › ACF PRO › have_rows() not working › Reply To: have_rows() not working
just to get sure:
you check frontpage for a page/post/custom-post where you have some content filled at backend. either photo or text.
<?php
// check if the flexible content field has rows of data
if( have_rows('travel_gallery') ):
// loop through the rows of data
while ( have_rows('travel_gallery') ) : the_row();
if( get_row_layout() == 'travel_text_row' ){
$get_travel_text = get_sub_field('travel_text');
echo $get_travel_text;
echo '<br>normally above should stand the text';
}
if( get_row_layout() == 'travel_photo_row' ){
$get_travel_photo = get_sub_field('travel_photo');
echo $get_travel_photo;
echo '<br>normally above should come the image';
}
endwhile;
else :
// no layouts found
echo 'no layouts found';
endif;
?>
your code look correct. but what is the result when you use mine instead?
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.