Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active August 29, 2015 14:20
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 srikat/c821e374b20c0346858f to your computer and use it in GitHub Desktop.
Save srikat/c821e374b20c0346858f to your computer and use it in GitHub Desktop.
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