Last active
October 28, 2017 19:52
-
-
Save anwerashif/52ea50c9bcd357f054fbfa4fdf4f55f1 to your computer and use it in GitHub Desktop.
Register Custom Featured Image Size for Page in Genesis
This file contains hidden or 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
<?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