Thou shall make your Wordpress Theme a Wordpress 2.5 Compliant
June 5, 2008 · Print This Article
If you’re blog is already running with Wordpress 2.5, I bet you must have created tons of image galleries within your posts already. Otherwise, it could be because you have disliked how the gallery post, the inside gallery pages and all its elements looked like. If that’s the case, I’m 99% sure that your Wordpress Theme is not Wordpress 2.5 compliant.
A Wordpress 2.5 Compliant theme must have an image.php template file. Having just a single.php template is not enough for you to be able to optimize the looks and functionality of your Wordpress 2.5 Image Gallery. Without this new file, your image gallery would only look as dull as this as compared to the screen shot below. And how to make an image.php template file is what we’re going to expound in this entry. But fret not, for creating this image.php template file is easy, even a faint-hearted soul would not have much trouble if the necessary procedures are followed.
First, you’ll have to make a duplicate copy of your single.php template file and name it as image.php.

Sample Wordpress 2.5 Image Gallery post

Sample Inside page of a Wordpress 2.5 Image Gallery
Now in order to make your image.php template file to display and work like the one on the sample gallery screenshot, you’ll have to make a few necessary replacements with the elements. Wordpress 2.5 Gallery have six major elements and if properly positioned in the image.php template file, the result is undeniably breath-taking. Now, the six major elements of a Wordpress 2.5 Gallery are the following:
- Full sized image;
- Image title;
- Image caption;
- Image description;
- Previous image thumbnail navigator; and
- Next image thumbnail navigator.
On you newly created image.php template file, look for the line similar to this:
<?php the_content(’<p class=”serif”>Read the rest of this entry »</p>’); ?>
You what it is right? It’s the post content element which displays the content of your blog entry. Now replace it with the following lines:
<p class=”attachment”><?php echo wp_get_attachment_image( $post->ID, ‘large’ ); ?>
<p><?php if ( !empty($post->post_content) ) the_content(); ?></p>
The first one pulls out the corresponding full sized image and displays it in the inside pages of your Wordpress 2.5 Image Gallery. The second line captures and prints the corresponding image description. This will be ignored when you didn’t create a corresponding description for the image during your upload.
Now for the previous and next image navigation, check your newly created image.php template file for the previous and next post navigation code which is similar to these:
<div class=”alignleft”><?php previous_post_link(’« %link’) ?></div>
<div class=”alignright”><?php next_post_link(’%link »’) ?></div>
and replace them with these:
<div class=”alignleft”><?php previous_image_link() ?></div>
<div class=”alignright”><?php next_image_link() ?></div>
Done?
Now do the necessary template styling as you please, save the file and upload it in your blog’s template folder.
If you liked "Thou shall make your Wordpress Theme a Wordpress 2.5 Compliant", you may also be interested in these articles:

thanks… very useful for me…
Thank you! This was very helpful - I’m up and running with galleries on my client’s site now.
Have you tried leaving comments in the separate image pages. The comments do not actually show up….
deuts, mine’s showing up. have you had the fix now already?