Last active
August 29, 2015 14:20
-
-
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/
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
// 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>'; | |
} |
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
.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