-
-
Save billerickson/b75b66c3ad2b386048fdc60ba8927441 to your computer and use it in GitHub Desktop.
This file contains 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 | |
add_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); | |
add_action( 'genesis_post_content', 'genesis_do_post_image' ); | |
/** | |
* Echo the post image on archive pages. | |
* | |
* If this an archive page and the option is set to show thumbnail, then it gets the image size as per the theme | |
* setting, wraps it in the post permalink and echoes it. | |
* | |
* @since 1.1.0 | |
*/ | |
function genesis_do_post_image() { | |
if ( ! is_singular() && genesis_get_option( 'content_archive_thumbnail' ) ) { | |
$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 ) ) { | |
genesis_markup( array( | |
'open' => '<a %s>', | |
'close' => '</a>', | |
'content' => wp_make_content_images_responsive( $img ), | |
'context' => 'entry-image-link', | |
) ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment