Skip to content

Instantly share code, notes, and snippets.

@neilgee
Created September 18, 2018 08:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilgee/b5df702da5ef092b4cd48d57dec32768 to your computer and use it in GitHub Desktop.
Save neilgee/b5df702da5ef092b4cd48d57dec32768 to your computer and use it in GitHub Desktop.
Link Featured Image to Linked Media Image
<?php
// 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