Skip to content

Instantly share code, notes, and snippets.

@nhatdongnguyen
Created May 1, 2015 04:20
Show Gist options
  • Save nhatdongnguyen/d66c1583332f4fe363fa to your computer and use it in GitHub Desktop.
Save nhatdongnguyen/d66c1583332f4fe363fa to your computer and use it in GitHub Desktop.
<?php
// 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>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment