Featured Image Link To Post
Hi there,
Is there a good way to make the entire featured image in the post or portfolio grid link to the post/portfolio item? Using the portfolio grid element or the portfolio with the style "grid" achieve this effect; however, I can't achieve this effect with options like the masonry grid style for "blog" elements or "masonry with description" style portfolio elements. Is there something I can add to the functions.php file perhaps? I tired one solution that seemed to work for many people, but it would A) move the "next" and "previous" blog post thumbnails around and not actually cause the featured images to link to the posts (the entire point). That code is below, in case it's a good starting point.
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
function my_post_image_html( $html, $post_id, $post_image_id ) {
$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
return $html;
}
Comments
we are sorry but it is not possible unfortunately.
Thanks for understanding!