Skip to content

Instantly share code, notes, and snippets.

Created Sep 18, 2018
What would you like to do?
Link Featured Image to Linked Media Image
// Create the variable for the large image src link
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
// Out the Post Title Using the post permalink for the post link - then the image which links to its large size
<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<a class="lightboxclassname" href="<?php echo $large_image_url[0]; ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('medium'); ?></a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment