Create a gist now

Instantly share code, notes, and snippets.

@sumobi /gist:8982224
Last active Aug 29, 2015

What would you like to do?
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