When browsing through the gallery, I already have added the option for my users to click on Previous / Next Image. But what I want to do now is: I want them to be able to click the image and that will take them to the next image in the gallery. Much like facebook… Please help.
I want users to be able to click that big image to take them to the next image ! 🙂
Is the very hard to do ? It seems like no one can help me…
Well, you need a plugin to do it. Try the lightbox plugin for wordpress, it support single or group image show and you can find it in plugin category.
The Lightbox plugin does not do what I want… i want to keep my gallery how it is now. None of that light box fancy stuff…
Can someone PLEASE help 🙁 I just want to make ONE image clickable so users could go to the next image in the gallery.. how hard can that be?!!
I can’t help you, but maybe you can help me. What did you use to cycle through the images in the gallery??
You have to create a image.php file within your theme. You can use the default theme and use that one…
CAN someone HELP ME :(?
<?php // code copied from adjacent_image_link() in wp-include/media.php $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') )); foreach ( $attachments as $k => $attachment ) if ( $attachment->ID == $post->ID ) break; $next_url = isset($attachments[$k+1]) ? get_permalink($attachments[$k+1]->ID) : get_permalink($attachments->ID); ?> <p class="attachment"><a href="<?php echo $next_url; ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a></p>
This will do.
Works!!!!!! Thank you so much Yoshi. You have solved all my problems! You are the best!
Where do I have to place that code?
It’s a while since I worked on my albums code, but if I remember correctly, yoshi’s code replaced the line:
<p class="attachment"><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a></p>
in the image.php file of the default WordPress theme.
Work on a copy of the image.php file so that you have the original to go back to if things go wrong as you experiment with new album designs.
Ok, thanks jtonline 🙂 That works great.
1 Thing left.. I’m looking for a code / widget that shows a random image from all wordpress galleries and also links to the generated image.
When you post an album, do you make 2 different posts? Because at the album index you have a thumbnail with description. After clicking the image gallery is different and the thumbnail isn’t in the post anymore :/
…at the album index you have a thumbnail with description. After clicking the image gallery is different and the thumbnail isn’t in the post anymore…
Erm – yes it is 🙂
My index for all available albums lists each with a heading, a photo, a description, and a note of the number of photos the album contains. This index is just a Category Template that I created to display my ‘Photos’ category.
If you click a photo or album name in the album index, you are taken to the post which contains thumbnails of all the album photos. The photo that was used in the album index is included, it’s always the last one in the post and is the standard way WordPress works.
I just use several posts (one for each photo album). Each post has a gallery included in it. Each post is allocated to a ‘Photos’ category. There is a category template file for the ‘Photos’ category so that the list of albums looks different from a list of posts from any other category in the blog.
It doesn’t get much more complicated than that for my albums.
- The topic ‘Gallery – Click on Image to view Next Image? How?’ is closed to new replies.