Hi all!
I’ve been trying to achieve something for days. Make a title “h2” appear only when my repeater has rows in it, and only once….
Anybody has an idea?
Cheers,
<?php
if( have_rows('flight_information') ):?>
<h2><img src="<?php echo get_bloginfo('template_directory');?>/icons/accomodation.png" alt="accomodation"/> Lodging</h2>
<?php
while( have_rows('flight_information') ): the_row();
the_sub_field('traveller_name');
if( have_rows('flight_informations') ):
while( have_rows('flight_informations') ):the_row();
the_sub_field('date');
the_sub_field('flight_number');
the_sub_field('departure_time');
the_sub_field('arrival_time');
endwhile;
endif;
the_sub_field('tripit_url');
endwhile;
endif;
?>
Which one of the sub fields above is the value you only want to appear once?
Also, is this for a nested repeater? It looks that way but I want to make sure.