i included this code into my Image Attachment Template (image.php) file to display a gallery of thumbnails for the current post.
function show_all_gallery_thumbs()
{
global $post;
$post = get_post($post);
/* image code */
$images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent='.$post->post_parent);
if($images)
{
$thumblist = '<ul class="thumbnails">';
foreach( $images as $imageID => $imagePost )
{
unset($the_b_img);
$the_b_img = wp_get_attachment_image($imageID, array(64,64));
$thumblist .= '<li class="span1"><a href="'.get_attachment_link($imageID).'" class="thumbnail">'.$the_b_img.'</a></li>';
}
$thumblist .= '</ul>';
}
return $thumblist;
}
how would i detect which image is being viewed and disable / highlight the image in my gallery thumbnail?
you almost go it. all you have to do it get the current image using
get_attachment_link()
and compare it with yourget_attachment_link($imageID)
here is you code
documentation on get_attachment_link() is available here