Support

Account

Home Forums Front-end Issues If field is Empty then show a Custom Text

Solved

If field is Empty then show a Custom Text

  • Hello,
    I am trying to show a text if field is empty then show a custom text.

    <?php
    if(get_field('last_date'))
    {
      echo 'Sep 28, 2017';
    }
    ?>

    I try this but its not working. How I can fix this issue…

  • I fixed it..

    <?php if ( get_field( 'field_name' ) ): ?>
    
    FIELD CODE....
    
    <?php else: // field_name returned false ?>
    
    OTHER CONTENT IF FIELD IS EMPTY
    
    <?php endif; // end of if field_name logic ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘If field is Empty then show a Custom Text’ is closed to new replies.