Before/After

v0.2 Download
14

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.

Installation

  • Download Before/After and unzip the files
  • Upload beforeafter.php to your /wp-content/plugins/ directory
  • Activate Before/After from the ‘Plugins’ area in WordPress

Use

  • Add images to your Media Library; these images will become available to you on the post add/edit page.
  • On the post add/edit page, simply drag images from the Media Library column into the Before and After columns.
  • To remove an item, double-click it.

Template Tags

$beforeafter->is_gallery( id );

Returns true if there is a Before/After gallery associated with a particular post.

  • Arguments
  • id :
    • A post id. Typically the current post, $post->ID
$beforeafter->gallery( type , id , file , links , list , rel , limit );

Returns the images stored in a particular Before/After gallery.

  • Arguments
  • type:
    • Determines which gallery to return: before or after.
    • Values: 'before' , 'after'
    • Default: 'after'
  • id:
    • The post id. If set to 0, will return images from all posts with Before/After galleries.
    • Default: 0
  • file:
    • Determines the type of image to return: the original image file, or the thumbnail.
    • Values: 'thumb' , 'file'
    • Default: ‘thumb’
  • links:
    • If set to true, will wrap images with links to the original files.
    • Values: true, false
    • Default: true
  • list:
    • If set to true, wraps the image in <li> tags.
    • Values: true, fase
    • Default: false
  • rel:
    • Alters the default rel parameter for image links.
    • Default: 'beforeafter'
  • limit:
    • Limits how many items are returned.
    • Default All of 'em

Examples

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>

Screenshots

Before/After

Notes

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!

  • Great plugin! Only one issue I'm having is that if I use images from the media library for a previous post I can't use them for another. Also if you delete a post and images associated with that post still are unusable.
  • Eric
    Can I use BA on page pages
  • Craig
    I installed this plugin on WordPress 3.0 RC1 and I get the following on activation "Parse error: syntax error, unexpected '}' in . . . beforeafter.php on line 185"
  • Hoping this can work for my and my clients... however, is there anywhere we can see a live demo?
  • rtforeman
    should this auto embed the before after code into my posts? i have now idea how to display the galley in the post? i've created it but now way to embed it?

    please let me know, also, is there an update to use this for pages available?
  • keighl
    The newest version, which will come out this week sometime, will have a built in gallery option that spits out a gallery if you want (using a shortcode). It will also be available on pages and posts. If you don't like the predefined gallery look, you can use the API functions to build your own. I plan on writing a tutorial for that.
  • rtforeman
    Thx. In the meantime how do i display the before/after images in the
    post? In there some code I'm missing??
    Cheers
    Ryan
  • Mo
    Hrm, is it difficult to get this to work for a page as well as a post? Right now it seems as if this tool is limited to posts.

  • keighl
    Hey, Mo. Right now it is. I'm actually have a new version that's almost done that will work on pages too.
  • Cvele
    I have installed wordpress 2.9.2 and I have a problem with drag and drop pictures in columns before and after. Pictures return to media library column. Any suggestions?
  • keighl
    I find it can be a little finicky on IE and Safari. Try another browser? The main problem is that the media library items are being dragged onto empty lists, so sometimes you need to wiggle them around until the first thumbails find it. After the first ones are in place it gets better. I should really put some placeholders in there.
  • Hi, this looks like just the kind of thing I'm looking for some of our property refurbishments, but I would need to be able to have an album of before/after for each project, not a global album - the plugin can do this?
    I hope so because on the surface of things it looks like this is brilliant! but I just need to clarify before installing.
    (great site by the way, your Menu+ plugin looks the dogs-nuts (excellent)..)
  • keighl
    You got it, you can create a new before/after gallery for any post. So, for each project you can simply create a WordPress post, and sort a gallery for it. If you have any problems, please let me know. I built this plugin for a landscaping company ... decided to open it up.
blog comments powered by Disqus