How to Register Custom Featured Image Size for Page in Genesis

How to Register Custom Featured Image Size for Page in Genesis

// 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>';
}
wprocket

 

GenesisPro728x90

Facebook
Twitter
LinkedIn
Pinterest
Tumblr
Anwer Ashif

Anwer Ashif

Founder of RainaStudio. Help businesses and individuals to create and outstand their online presence. Our success rate is measurable. Our blog served all around the world and counting.

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to speed up WordPress site?