Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barbwiredmedia/87c20a2c2458bc8de70b to your computer and use it in GitHub Desktop.
Save barbwiredmedia/87c20a2c2458bc8de70b to your computer and use it in GitHub Desktop.
ACF Advanced custom fields output field only if exists. Check if field exists and has content.
<?php if (get_field('your_field')): ?>
<?php the_field('your_field'); ?>
<?php endif; ?>
<!-- Else example -->
<?php if (get_field('your_field')) : ?>
<?php the_field('your_field'); ?>
<?php else : ?>
<!--alternate stuff-->
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment