Skip to content

Instantly share code, notes, and snippets.

@guilhermealveslopes
Created April 7, 2017 00:43
Show Gist options
  • Save guilhermealveslopes/bb1525974e994c5c248a25a7306e3883 to your computer and use it in GitHub Desktop.
Save guilhermealveslopes/bb1525974e994c5c248a25a7306e3883 to your computer and use it in GitHub Desktop.
If variable is null display X, else. display X
<?php $meta = get_post_meta( $post->ID, 'meta', true); <--! define o valor da variável -->
if (!empty($telefone)) { ?> <--! Confere se está vazia ou não -->
Resultado caso não seja nula.
<?php } else { ?>
Resultado caso seja nula.
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment