Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrew/8982224 to your computer and use it in GitHub Desktop.
Save amdrew/8982224 to your computer and use it in GitHub Desktop.
Easy Image Gallery - filter the gallery to simply link to the image's attachment page. If you want to add a CSS class for styling, uncomment out the line below and change my-class accordingly
<?php
function sumobi_easy_image_gallery_html( $html, $rel, $image_link, $image_class, $image_caption, $image, $attachment_id, $post_id ) {
// $image_class = 'class="my-class"'; // uncomment this if you'd like to add a CSS class to the anchor link
$image_link = get_attachment_link( $attachment_id );
$html = sprintf( '<li><a href="%s" %s title="%s">%s</a></li>', $image_link, $image_class, $image_caption, $image );
return $html;
}
add_filter( 'easy_image_gallery_html', 'sumobi_easy_image_gallery_html', 10, 8 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment