carasmo
10/12/2017 - 12:53 PM

featured-image-genesis.php

<?php
// DO NOT COPY THIS opening tag into your file. Use a code editor and ftp.

add_action( 'genesis_entry_content', 'yourprefix_display_featured_image', 5 );
/**
 * Show Featured Image Posts
 * @since  1.0.0
 */
function yourprefix_display_featured_image() {

	if ( ! has_post_thumbnail() || ! is_singular( 'post' ) ) return;
	
	$caption    = '';
	$caption    = get_post( get_post_thumbnail_id() )->post_excerpt;
		
	if ( ! empty( $caption ) ) :
		$caption = sprintf( '<figcaption>%s</figcaption>', $caption );
	endif;

	$image = genesis_get_image( array(
		'format'  => 'html',
		'size'    => 'your-featured-image-size', //change between the ticks to your featured image size
		'context' => '',
		'attr'    => '',
	) );
 	
	printf( '<figure class="featured-image aligncenter">%s%s</figure>', $image, $caption );
 		
}