Skip to content

Instantly share code, notes, and snippets.

@mvital
Forked from jpcontrerasv/ACF If Else field.php
Created January 11, 2017 12:26
Show Gist options
  • Save mvital/0fba82e78b8ca33d8369d45cb28b32c8 to your computer and use it in GitHub Desktop.
Save mvital/0fba82e78b8ca33d8369d45cb28b32c8 to your computer and use it in GitHub Desktop.
ACF If Else field
<?php if ( get_field( 'field_name' ) ): ?>
This is displayed when the field_name is TRUE or has a value.
<?php else: // field_name returned false ?>
This is displayed when the field is FALSE, NULL or the field does not exist.
<?php endif; // end of if field_name logic ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment