Skip to content

Instantly share code, notes, and snippets.

@alexmustin
Last active April 9, 2019 16:41
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 alexmustin/af9ebf8dc700fb2583f8698f4dcda192 to your computer and use it in GitHub Desktop.
Save alexmustin/af9ebf8dc700fb2583f8698f4dcda192 to your computer and use it in GitHub Desktop.
Genesis: Add the Featured Image to Single Post pages
<?php
// Add featured image on single post
add_action( 'genesis_entry_header', 'hellopro_featured_image', 1 );
function hellopro_featured_image() {
$image = genesis_get_image( array(
'format' => 'html',
'size' => 'featured',
'context' => '',
'attr' => array ( 'class' => 'aligncenter' ),
) );
if ( is_singular()) {
if ( $image ) {
printf( '<div class="featured-image">%s</div>', $image );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment