Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active Aug 29, 2015
Embed
What would you like to do?
How to display Featured image before entry content on Posts and Pages in Genesis. https://sridharkatakam.com/how-to-display-featured-image-before-entry-content-on-posts-and-pages-in-genesis/
// Register a custom image size for Singular Featured images
add_image_size( 'singular-featured-thumb', 800, 250, true );
add_action( 'genesis_before_entry', 'sk_display_featured_image' );
function sk_display_featured_image() {
if ( ! is_singular( array( 'post', 'page' ) ) ) {
return;
}
if ( ! has_post_thumbnail() ) {
return;
}
// Display featured image above content
echo '<div class="singular-featured-image">';
genesis_image( array( 'size' => 'singular-featured-thumb' ) );
echo '</div>';
}
.singular-featured-image img {
vertical-align: top;
}
@media only screen and (max-width: 800px) {
.singular-featured-image {
margin-bottom: 40px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment