// Add featured image to posts/pages.
add_action( 'genesis_entry_content', 'spi_do_featured_image', 1 );
function spi_do_featured_image() {
// if we are not on a single Post page, abort.
if ( ! is_singular( 'post' ) ) {
return;
}
$show_image = get_theme_mod( 'spi_single_image_setting', true );
$img = genesis_get_image( array(
'format' => 'html',
'size' => genesis_get_option( 'image_size' ),
'context' => 'archive',
'attr' => genesis_parse_attr( 'entry-image', array ( 'alt' => get_the_title() ) ),
) );
if ( ! empty( $img ) && ( true === $show_image ) ) {
echo $img;
}
}
Comments