Last active
April 9, 2019 16:41
-
-
Save alexmustin/af9ebf8dc700fb2583f8698f4dcda192 to your computer and use it in GitHub Desktop.
Genesis: Add the Featured Image to Single Post pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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