Home Forums Add-ons Repeater Field If sub field is empty add custom text


If sub field is empty add custom text

  • Hi
    Can some one help me with this one please. I want to display custom text if get_sub_field(‘package_details’); is empty. But no luck so far.
    Thank you

     <?php while( have_rows('packages') ): the_row(); ?>
         <li id="tab-1" ><?php the_sub_field('conference_partner'); ?> <?php the_sub_field('exhibition_stand'); ?> <?php the_sub_field('delegate_places'); ?>  
         <?php the_sub_field('number_of_packages'); ?> <?php the_sub_field('package_details'); ?>
         $sub_field_3 = get_sub_field('package_details'); 
         // do something with $sub_field_3
     <?php endwhile; ?>
    <?php endif; ?>
    $sub_field_3 = get_sub_field('package_details'); 
    if (!$sub_field_3) {
      $sub_field_3 = 'some default value here';
    echo $sub_field_3;
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘If sub field is empty add custom text’ is closed to new replies.