How to use Slimbox plugin to display your portfolio in WordPress
If you’ve been following the Bluelime Media website you will know that we’ve partnered with Barbara from BlueCitrus on many occasions to develop websites and as the saying goes, “The son of the cobbler has no shoes“, the BlueCitrus website was in need of a facelift. My latest teaching gig at Langara provided me with the opportunity to design and develop a WordPress site for Barbara. The goal of the class was to teach the students how to use WordPress to create a portfolio. So building a site for Barbara was the perfect project.
Barbara laid the ground work and designed the header, navigation and gave me a good indication of how she wanted the site to work, but I was given carte blanche on how to make the portfolio work. After looking at numerous portfolio examples, I came across the stunning work of Koldo Barroso. Koldo’s illustrations are simply marvelous and I could look at them all day. His portfolio section is simple, yet very elegant. On closer examination of his site, I noticed that he uses Slimbox to display his gallery pieces which is just a slimmed down version of the original Lightbox.
A few clicks later, I read a few tutorials on how to use Slimbox and decided to use it to build it Barbara’s portfolio section. If you’re familiar with WordPress plugins, you’ll know that beyond how to install and activate, instructions are usually fairly slim when it comes to how to use them. Since I just finished the site and the steps I took are still fresh in my mind, I thought I’d walk you through on how to set your own gallery using the Slimbox Plugin.
Step 1:
Download the Slimbox plugin, upload it to your plugins folder and activate it.
Step 2:
Get your portfolio images ready. During the design process, I came to the decision of making my large images 500px x 405px and the thumbnails 110px x 80px. In my WordPress admin, under Media, I set the size of my thumbnails to 110px and 80px. I then proceeded to create all of the portfolio images and uploaded them using WordPress’s media tool. During this process, WordPress automatically created corresponding thumbnails and added a -100×80.jpg extension to them. The thumbnails weren’t exactly as Barbara had hoped for, so I downloaded them all, she tweaked them in Photoshop ensuring the the same names were kept, I then re-uploaded them to the server and replaced the old ones.
Step3:
Once the images in the media library, it was time to add them to the WordPress Websites Page. I opted for a unordered list of items to display the thumbnails.
Using the image insert tool, I selected the image to show, fine-tuned the title of the image, ensured that the file url was selected, selected the thumbnail size and clicked insert into post.
Which gave me the following line of code.
<ul class="thumbnails">
<li>
<a href="http://www.domainname.com/wp-content/uploads/image1.jpg"><img title="Portfolio Piece 1" src="http://www.domainname.com/wp-content/uploads/image1-100x80.jpg" alt="Portfolio Piece 1" width="100" height="80" /></a>
</li>
</ul>
In order to activate the lightbox, I then inserted rel=”lightbox” to the anchor tag.
<ul class="thumbnails">
<li>
<a href="http://www.domainname.com/wp-content/uploads/image1.jpg" rel="lightbox"><img title="Portfolio Piece 1" src="http://www.domainname.com/wp-content/uploads/image1-100x80.jpg" alt="Portfolio Piece 1" width="100" height="80" /></a>
</li>
</ul>
In order to display the caption under the image a title must also be added to the anchor tag.
<ul class="thumbnails">
<li>
<a href="http://www.domainname.com/wp-content/uploads/image1.jpg" rel="lightbox" title="Portfolio Piece 1"><img title="Portfolio Piece 1" src="http://www.domainname.com/wp-content/uploads/image1-100x80.jpg" alt="Portfolio Piece 1" width="100" height="80" /></a>
</li>
</ul>
This code now works perfectly, but you probably want to display more than one image. All you need to do is repeat the process and modify the relative attribute. Instead of using rel=”lightbox” I used rel=”lightbox-website” on all anchor tags. Modifying the relative attribute this way activates the previous and next links on the images.
<ul class="thumbnails">
<li>
<a href="http://www.domainname.com/wp-content/uploads/image1.jpg" rel="lightbox-website" title="Portfolio Piece 1"><img title="Portfolio Piece 1" src="http://www.domainname.com/wp-content/uploads/image1-100x80.jpg" alt="Portfolio Piece 1" width="100" height="80" /></a>
</li>
<li>
<a href="http://www.domainname.com/wp-content/uploads/image2.jpg" rel="lightbox-website" title="Portfolio Piece 2"><img title="Portfolio Piece 2" src="http://www.domainname.com/wp-content/uploads/image2-100x80.jpg" alt="Portfolio Piece 2" width="100" height="80" /></a>
</li>
</ul>
You’ll notice that on Barbara’s website, once you view the images in the lightbox, you can read the title of the image but also visit the website by clicking the link. To do this, you need to add the link to your title.
So you might be tempted to using something like:
title="Portfolio Piece 1 - <a href="http://www.domainname.com" target="_blank">visit website</a>"
But you will soon find out that this doesn’t work. What you need to do is swap some of the characters for their html equivalent. For example, quotes (”) would be " and brackets (<) would be <. So your final code will be something like this:
<ul class="thumbnails">
<li>
<a href="http://www.domainname.com/wp-content/uploads/image1.jpg" rel="lightbox-website" title="Portfolio Piece 1 - <a target="_blank" href="http://www.domainname1.com/">visit website</a>"><img title="Portfolio Piece 1" src="http://www.domainname.com/wp-content/uploads/image1-100x80.jpg" alt="Portfolio Piece 1" width="100" height="80" /></a>
</li>
<li>
<a href="http://www.domainname.com/wp-content/uploads/image2.jpg" rel="lightbox-website" title="Portfolio Piece 2 - <a target="_blank" href="http://www.domainname1.com/">visit website</a>"><img title="Portfolio Piece 2" src="http://www.domainname.com/wp-content/uploads/image2-100x80.jpg" alt="Portfolio Piece 2" width="100" height="80" /></a>
</li>
</ul>
Step4:
Once all your thumbnails are in place, you may want to adjust your style.css. Here’s what I used for the Bluecitrus website.
ul.thumbnails {width:520px; list-style:none; margin:0; padding:0;}
.thumbnails li {float:left; margin:5px 4px 5px 3px;}
.thumbnails img {width:110px; height:80px; padding:5px; vertical-align:bottom;}
.thumbnails a {border:1px solid #D4D4D4; background:#FFF; display:block; margin-bottom:5px; float:left;}
.thumbnails a:hover img {background:#F9F9F9;}

Thanks for the nice mention of Koldo’s portfolio! I just came across this while sneakily looking at his stats, hee hee.
I like slimbox a lot and have used it on several projects. It’s lighter than lightbox and pretty much has the same functionality. For the new site design, I decided to go with a WordPress lightbox plugin just to make the set up time faster.
I also tried a jquery plugin, but didn’t like that one as much.
Barbara’s site looks great!
Hey, when I upload a photo using the default photo loader in WordPress, it gives me a code that looks different from the one posted above? Then, when I try to insert the ‘rel=”lightbox”‘ code into what looks like the correct place, nothing happens. I just have a thumbnail image that does not link to even the original image in full size. Am I doing something wrong? Maybe there’s an update due to the latest WordPress upgrade? I’ve been trying for a while to get a “lightbox” plugin to work on my site, but I’m having lots of problems and I’m trying to teach myself. Any help you could offer would really be great!
Thanks,
J
Excellent post i am sure that i will come back here soon