Created
August 26, 2016 04:46
-
-
Save jpcontrerasv/5a494568b0d3276d370648a77eae773a to your computer and use it in GitHub Desktop.
ACF If Else field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ?> |
what if i want to show and remove based on user role? (front end)
answer please
Thanks
You probably don't need help anymore, but for anyone else looking:
What you need to do is make another separate PHP condition or make an && (and) condition, depending on what you need.
Example:
<?php if( get_field('has_prequel') || current_user_can('editor') ): ?> Success <?php endif;?>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what if i want to show and remove based on user role? (front end)
answer please
Thanks