Categories
Development

Incorporating Lightbox 2 effect with WordPress gallery

I wanted my client to be able to add pictures to a gallery using the build in WordPress gallery, but was hoping to customize the display of the gallery thumbs a bit. I was hoping to get it to display as the following:

      use the Lightbox 2 script
      able to override the CSS that is being written to the page

Since the default CSS that the gallery generates is written in the page, overriding the styles was kinda a pain to do in the site’s stylesheet I was using. However I did find that I could edit the default CSS that is being written to the page by the gallery by editing the following file:

/wp-includes/media.php

Locate the following code and edit as necessary:

	$output = apply_filters('gallery_style', "
		<style type='text/css'>
			#{$selector} {
 
			}
			#{$selector} .gallery-item {
				float: left;
 
				text-align: center;
							}
			#{$selector} img {
 
			}
			#{$selector} .gallery-caption {
				margin-left: 0;
			}
		</style>
		<!-- see gallery_shortcode() in wp-includes/media.php -->
		<div id='$selector' class='gallery galleryid-{$id}'>");

You can see I’ve removed some styles in this case.

Further edits can be made to the gallery from this file as well. I chose to use a little bit of javascript to attach the rel attribute to my anchors instead of editing the php file. Personally, I’d rather do that so in case a future version of WordPress altered the media.php file it’d be one less thing for me to worry about.

Very basic javascript to add the rel attribute that Lightbox 2 requires to the image anchors:

var galleryDivs = YAHOO.util.Dom.getElementsByClassName('gallery', 'div', 'bd');
for (var i = 0; i < galleryDivs.length; i++) {
    var imageAnchor = galleryDivs[i].getElementsByTagName('a');
    for (j = 0; j < imageAnchor.length; j++) {
        imageAnchor[j].setAttribute('rel', 'lightbox[gallery]');
    }
}

I use the YUI Dom collection to help me gather nodes.

Then it’s just a matter of calling the relevant dependancy scripts and styles into your page and it should work for you.

Categories
Development

Akismet WordPress Plugin

The Akismet WordPress Plugin is awesome. I was up to a couple of hundred or so spam comments a day on various WordPress hosted blugs, and it was getting to be quite a waste of time deciding what was a real comment of a wonderful gift of spam.

Downloading and installing the Akismet WordPress Plugin was simple.  Directions can be found on their site, it took me probably 5 minutes to get the whole think up and running. Also necessary for the install is a WordPress API key.  This can be gotten from the WordPress.  

Again, if you have a WordPress powered blog install the  Akismet plugin now.

Categories
Development

WordPress Template Errors with Dreamweaver CS4

This one had me scratching my head for a bit, so I figured I’d write it down.  While creating a new WordPress template the template name was coming up incorrectly in the WordPress admin. Instead of just displaying the name of the template, it was rendering all the info in the template. 

I kept checking existing templates that weren’t having this problem and could see no noticeable difference between mine and what they had typed. After much confusion, I decided that perhaps it was how Dreamweaver CS4 handled line returns. So I fired up a basic text editor and typed it all up and uploaded it and it worked fine! 

So now I’ll be coding up my WordPress templates in BBEdit not Dreamweaver CS4.

Categories
Development

Cow Licks Updates

Just wrapping up some site additions for Cow Licks Kids Salon.  

Slideshow

The client wanted a slideshow of images that they would be able to update and add images to.  So I created a pretty cool looking slideshow using Flash ActionScript 3.0.  It’s pretty cool.  It calls in the the images to be loaded through an xml file which the client can manipulate to alter the slideshow.  To reduce load time, each image is loaded a few seconds before it’s to appear on the stage.  

Parties Page

The client wanted to expand their offerings on their fast growing parties that they are offering.  Geoff came up with a slick design for the client which I was able to turn into a tabbed interface.  The tabs was built on YUI TabView.  YUI is a great library, and probably my favorite Javascript library out there now.  The site makes heavy use of YUI throughout.

Contact Form

Added a contact form to the site for users to contact the client.  It’s a pretty basic contact form written in PHP with some basic form validation thrown in there too.

WordPress CMS

Converted the existing static site over to WordPress to serve their CMS needs.  The client can now login to an admin app and make basic content changes on their own, without the need to FTP or pay someone else for basic site changes.

MooNews

Added a MooNews area on the homepage for the client to easily add latest news to their site via the newly installed CMS.

Categories
Development

ACCCEA Site

Just updated the ACCCEA (Atlantic Cape Community College Education Association) website.  They were one of the first freelance sites I built.

The biggest upgrade to their site was moving their blog from the custom one I built for them a few years ago to being powered by WordPress.  As a result of the upgrades they now have a fully featured CMS (Content Management System).  So now they can just login and make edits to their website on their own.

Moving the blog over to WordPress also gives them a much more feature rich blogging engine then what they were currently using.  They can be a lot more creative when writing posts, adding images, video clips, styling the text, etc.

Categories
Development

Upgraded to WordPress 2.5

Just upgraded to WordPress version 2.5 yesterday.  My host Dreamhost has a super easy 1 click upgrade, so it only took a few minutes for the upgrade.  Just had to update the database and I was all set.  My custom theme didn’t break, nor does there seem to be anything else broken (cross my fingers) since the upgrade.

From the user end not too much will probably change as a result of this upgrade.  But the admin upgrades with 2.5 are very impressive.  The whole look and feel has been overhauled in a good way.  It took a few minutes for me to adjust to some of the changes, but so far so good.  

The upgraded RTE (Rich Test Editor) is great, works so much better with Safari.  The Add media functions are a great addition, including a YouTube video in a post just got a whole lot easier.  Overall I’m very impressed with the upgrade and will begin moving my clients over to 2.5.