How to get browsable image galleries in your current WordPress theme
I’ve been using this theme on my websites long enough that it’s been tweaked and gotten crufty and it’d be a major pain to change it.
But I really like the new image gallery browsing in WordPress 2.5.1.
Turns out all you need to do is to add one file ‘images.php’ to your theme. You can download image.php.txt and just drop the .txt off it. Upload it to the directory of your current theme. It should work on all themes.
Here are some themes I’ve created image gallery files for:
image.php for Devart’s theme
image.php for New Balance of Blue
Manhattan theme
Sliding Door theme
Wasteland theme
Download the file for your theme, rename it image.php and upload it to your theme directory.
Example: BirdsTX
In your posts you can change the number of columns displayed in your gallery. The tag displays the default of 3. You can use to get 4 columns or choose what ever number of columns you’d like.
Or just cut and paste the text below into a file named images.php in your current theme gallery.
<?php get_header(); ?>
<div id="content" class="widecolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2><a href=”<?php echo get_permalink($post->post_parent); ?>” rev=”attachment”><?php echo get_the_title($post->post_parent); ?></a> » <?php the_title(); ?></h2>
<div class=”entry”>
<p class=”attachment”><a href=”<?php echo wp_get_attachment_url($post->ID); ?>”><?php echo wp_get_attachment_image( $post->ID, ‘medium’ ); ?></a></p>
<div class=”caption”><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the “caption” ?></div>
<?php the_content(‘<p class=”serif”>Read the rest of this entry »</p>’); ?>
<div class=”navigation”>
<table><tr>
<td><?php previous_image_link() ?></td>
<td><?php next_image_link() ?></td>
</tr></table>
</div>
<br class=”clear” />
</div>
</div>
<?php comments_template(); ?>
<?php endwhile; else: ?>
<p>Sorry, no attachments matched your criteria.</p>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Leave a Reply
You must be logged in to post a comment.



