Skip to main content
1 of 3
fuxia
  • 107.1k
  • 38
  • 255
  • 459

You could WordPress’ built-in Thickbox script. Just place the following code somewhere before wp_footer();:

add_action( 'wp_footer', 't5_thickbox_jquery' );

function t5_thickbox_jquery()
{
?>
<script>
jQuery( 'a img.size-medium, a img.attachment-thumbnail' )
    .parent()
    .addClass( 'thickbox' )
    .attr( 'rel', 'page' );
</script>
<?php
add_thickbox();
}

See this answer for more details.

fuxia
  • 107.1k
  • 38
  • 255
  • 459