/** * Get featured image markup. * * Only when the single Post or Page has a featured image, and only when * showing the first page when the Page or Post is divided into multiple * pages using next page quicktag. * * @author Sridhar Katakam * @author Gary Jones * @link http://sridharkatakam.com/display-featured-image-header-minimum-pro/ * * @return string|bool Image markup if image could be determined */ function sk_get_featured_image() { // Uncomment the lines below if you want to limit to *just* featured // images, and not fallback to first-attached images. // if ( ! has_post_thumbnail() ) { // return; // } if ( ! is_page() && ! is_single() ) { return; } if ( (int) get_query_var( 'page' ) > 0 ) { return; } // If post has no featured image, it will attempt to fallback to // first-attached image if the first conditional in this function // is commented out. return genesis_get_image( 'class=aligncenter' ); } add_action ( 'genesis_entry_header', 'sk_featured_image', 5 ); /** * Display Featured image after header. * * Only on the first page when the Page or Post is divided into multiple * using next page quicktag. * * Scope: static Pages and single Posts. * * @author Sridhar Katakam * @author Gary Jones * @link http://sridharkatakam.com/link-to-your-tutorial */ function sk_featured_image() { if ( $image = sk_get_featured_image() ) { echo ''; } }