Skip to content

Instantly share code, notes, and snippets.

@generatepress
Created February 11, 2016 06:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save generatepress/65aff21092a25e5a6f97 to your computer and use it in GitHub Desktop.
Save generatepress/65aff21092a25e5a6f97 to your computer and use it in GitHub Desktop.
Remove the link to the single post from the post image
if ( ! function_exists( 'generate_post_image' ) ) :
/**
* Prints the Post Image to post excerpts
*/
add_action( 'generate_after_entry_header', 'generate_post_image' );
function generate_post_image()
{
// If there's no featured image, return
if ( ! has_post_thumbnail() )
return;
// If we're not on any single post/page or the 404 template, we must be showing excerpts
if ( ! is_singular() && ! is_404() ) {
?>
<div class="post-image">
<?php the_post_thumbnail( apply_filters( 'generate_page_header_default_size', 'full' ), array('itemprop' => 'image') ); ?>
</div>
<?php
}
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment