Background Stretcher

06.13.2011

First I tried this background stretcher but couldn’t get it to work with WordPress. I’m guessing maybe it was a JavaScript conflict or my file paths were wrong.

http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html

Then I thought maybe there’s a plug-in for this and indeed there was.

http://gecka-apps.com/documentation/bgstretcher/

There were a few tricks that I needed to do in order to get this to work. First, I had to add add_custom_background(); to my functions.php file. This gives me the background settings under appearance settings in WordPress.

Second, I had to add add_streched_background() to functions.php. This takes in many parameters to control the background and slideshow settings. Since I wasn’t familiar with PHP syntax, I had to look up function arguments for PHP.

After I figured out how to pass in parameters in PHP, I needed to pass in the container tag that I use as my page wrapper, since it is different than the default.

http://php.net/manual/en/functions.arguments.php

 

After that and setting the background under the appearance settings, BG stretcher was up and running. However, it was only one image.

To get the slideshow working, I had to pass in an array of URLs of images. Once that was done, and I uploaded the images to the proper directory, the slideshow was up and running. But it changed slides too quickly. Fortunately, there is a way to change that. With the nextSlideDelay parameter. Just give it a delay in milliseconds.

Finally, the transition was too quick. Fortunately, that could also be changed with the slideShowSpeed parameter. However, for this, I had to dig into the plug-in PHP code because quotes were surrounding the slideshow speed variable. This made me unable to pass in an integer. So I had to remove the quotes. I got a fatal error during this a few times. If that happens you must reactivate the plug-in. or you could just leave it be and pass in a ‘slow’, ‘normal’, or ‘fast’ parameter. But I found that slow was still too fast.

 

example of what goes in functions.php:

add_custom_background();
add_streched_background(array(‘pageWrapper’ => ‘#page’,
‘background’ => array(‘http://www.travisluong.com/wp-content/uploads/2011/06/bg_danshui.jpg’, ‘http://www.travisluong.com/wp-content/uploads/2011/06/bg_korea.jpg’),
‘slideShowSpeed’ => 5000,
‘nextSlideDelay’ => 10000));