Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
Forked from davemac/gist:3484845
Created January 26, 2020 02:25
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 jamiemitchell/27eca23f02f7db80ca39f05c0b64f906 to your computer and use it in GitHub Desktop.
Save jamiemitchell/27eca23f02f7db80ca39f05c0b64f906 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