Organize “before and after” style portfolios embedded within WordPress posts. Before/After allows you to select specific images out of your media library, and sort them into respective before and after groups from the post editing page. Useful for anyone who features their work or services (web-designers, artists, plumbers, etc.) on their site.
beforeafter.php to your /wp-content/plugins/ directory$beforeafter->is_gallery( id );
Returns true if there is a Before/After gallery associated with a particular post.
$post->ID$beforeafter->gallery( type , id , file , links , list , rel , limit );
Returns the images stored in a particular Before/After gallery.
'before' , 'after''after'0, will return images from all posts with Before/After galleries.0'thumb' , 'file'true, falsetrue<li> tags.true, fasefalserel parameter for image links.'beforeafter' All of 'em
Returns the two separate galleries associated with the current post.
<?php if ($beforeafter->is_gallery($post->ID)) : ?>
<div>
<h3>After</h3>
<?php
$beforeafter->gallery('after' , $post->ID , 'thumb' , true, false);
?>
</div>
<div>
<h3>Before</h3>
<?php
$beforeafter->gallery('before' , $post->ID , 'thumb' , true , false);
?>
</div>
<?php endif; ?>
Returns the images from all ‘after’ galleries on all posts.
<div>
<h3>Recent Projects</h3>
<?php
$beforeafter->gallery('after' , 0 , 'thumb' , true, false);
?>
</div>
Before/After is not pre-attached with any style or gallery module. You can style it any way you’d like, and the galleries will fit into many image tools like Lightbox (note the definable rel attribute). Use CSS to change things like image size.
As of now, you can use an image from the Media Library in only one Before/After gallery across the site. I’ve wired it this way to prevent potential confusion. If folks see the need to have images featured in multiple galleries, I can create the option.
Please bring any bugs, issues, or suggestions to my attention below!