WordPress Post Gallery Plugin
Update: Post Gallery is officially deprecated. Attachments has taken its place.
This WordPress plugin gives you the ability to append any number of images (along with titles and captions) to your posts. Existing images can be resorted and removed at any time.
The plugin makes use of Ajax file upload by Andrew Valums.
Installation
- Download the file and unzip it. Upload the ‘post-gallery’ folder and its subfolders to your /wp-content/plugins/ directory.
- Activate the plugin through the ‘Plugins’ admin menu in WordPress
Usage
To retrieve an associative array containing all Gallery images for a post, use the following within The Loop:
<?php $post_images = post_gallery_get_images(); ?>
You will be provided an associative array with which to work in your template:
<?php $total_images = sizeof($post_images); ?>
<?php if($total_images>0) : ?>
<div class="post_gallery">
<ul>
<?php for ($i = 0; $i < $total_images; $i++) : ?>
<li>
<div class="image_title"><?php echo $post_images[$i]['image_title']; ?></div>
<div class="image">
<a href="<?php bloginfo('url'); ?>/wp-content/plugins/post-gallery/thirdparty/phpthumb/phpThumb.php?src=<?php bloginfo('url'); ?>/wp-content/plugins/post-gallery/uploads/<?php echo $post_images[$i]['image_location']; ?>&w=500&h=500&zc=1" id="image_<?php echo $i+1; ?>">
<img src="<?php bloginfo('url'); ?>/wp-content/plugins/post-gallery/thirdparty/phpthumb/phpThumb.php?src=<?php bloginfo('url'); ?>/wp-content/plugins/post-gallery/uploads/<?php echo $post_images[$i]['image_location']; ?>&w=85&h=85&zc=1" alt="Thumbnail" />
</a>
</div>
<div class="image_caption"><?php echo $post_images[$i]['image_caption']; ?></div>
</li>
<?php endfor ?>
</ul>
</div>
<?php endif ?>
Screencast
Changelog
- Version 1.0.3
- March 18th, 2009 – The uploads directory is now automatically created during activation. Now includes the option to add a Gallery to Pages via new Settings page.
- Version 1.0
- Februrary 17th, 2009 – Now correctly returns an accurate record of images per post. There was a bug present which possibly returned an empty record.
- Version 1.0 beta
- February 8th, 2009 – Initial release

