I pasted this snippet into my functions.php and I want to change <a href="%1$s">
so that it opens blog posts full-sized featured image (instead of the blog post itself).
Any tips?
I would like the <a href="%1$s">
to return the_post_thumbnail('full')
– https://wordpress.stackexchange.com/a/167309
function generate_post_image() {
// If there's no featured image, return.
if ( ! has_post_thumbnail() ) {
return;
}
// If we're not on any single post/page or the 404 template, we must be showing excerpts.
if ( ! is_singular() && ! is_404() ) {
echo apply_filters( 'generate_featured_image_output', sprintf( // WPCS: XSS ok.
'<div class="post-image">
<a href="%1$s">
%2$s
</a>
</div>',
esc_url( get_permalink() ),
get_the_post_thumbnail(
get_the_ID(),
apply_filters( 'generate_page_header_default_size', 'full' ),
array(
'itemprop' => 'image',
)
)
) );
}
}