Skip to content

Instantly share code, notes, and snippets.

@anwerashif
Last active October 28, 2017 19:52
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 anwerashif/52ea50c9bcd357f054fbfa4fdf4f55f1 to your computer and use it in GitHub Desktop.
Save anwerashif/52ea50c9bcd357f054fbfa4fdf4f55f1 to your computer and use it in GitHub Desktop.
Register Custom Featured Image Size for Page in Genesis
<?php
// Do NOT include the opening PHP tag
// Register a custom image size for Singular Page Featured images
add_image_size( 'singular-page-featured-thumb', 1277, 300, true );
// Display image before content-sidebar-wrap
add_action( 'genesis_before_content_sidebar_wrap', 'page_display_featured_image' );
function page_display_featured_image() {
if ( ! is_singular( array( 'page' ) ) ) {
return;
}
if ( ! has_post_thumbnail() ) {
return;
}
// Display featured image above content
echo '<div class="singular-page-featured color-gradient mobile-hide">';
genesis_image( array( 'size' => 'singular-page-featured-thumb' ) );
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment