Skip to content

Instantly share code, notes, and snippets.

@davemac
Created August 27, 2012 01:13
Show Gist options
  • Save davemac/3484845 to your computer and use it in GitHub Desktop.
Save davemac/3484845 to your computer and use it in GitHub Desktop.
Check if ACF fields exists
<?php elseif ( has_post_thumbnail() ) :
$featured_image_link = ( get_field( 'featured_image_links_to' ) );
if ( $featured_image_link ) {
echo '<a href="'.get_permalink($post_object->ID) .'">';
if ( has_post_thumbnail()) { the_post_thumbnail( 'hero-image-medium', array( 'class' => 'large fx' ) ); }
echo '</a>';
} else {
the_post_thumbnail( 'hero-image-medium', array( 'class' => 'large fx' ) );
};
endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment