Support

Account

Home Forums Add-ons Repeater Field Title in repeater

Helping

Title in repeater

  • 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.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Title in repeater’ is closed to new replies.