WordPress Themes

So, I have been sitting here thinking I need to update the theme I am using to 2.7, when I found this link. There are a ton of resources listed here about WordPress themes, but the most interresting is here.¬† It is about Justin Tadlock, and how he created a “base” theme for you to use. Using this well structured base, you may only need to modify css files. His “base” theme is called hybrid, and it is not the prettiest theme, but it is not meant to be. It is to be the starting point. He has two child themes there that both start with hybid, and they are very different. Hmmmm. Maybe that is the way to go…

Javascript Speed Tests

As part two of yesterdays Javascript Speed post, I have an interresting link. MooTools, another Javascript library, has a speed comparison page up here. I had looked at MooTools a while back when I put up the slideshow piece on the front page of the site. I didn’t look into it too much, but it seemed small and compact. Anyway, the speed comparison is interresting. If you go to the site, press the “start tests” button in the upper right to see the differences. I got here while I was looking into jQuery. Prototype gets smacked in the speed test. Yikes.

This post is from 2007, but was already complaining that WordPress was going to use Prototype instead of jQuery for version 2.0. (which was just released a month ago) It would appear to me though that WordPress went and switched to jQuery. Looking at the WordPress docs, I found this page on AJAX, and it talks about jQuery.  When I look at the source of one of the admin pages, there is jQuery references all over, but nothing about prototype.

Looks like WordPress has switched to jQuery, and if I am looking at making plugins for wordpress, I might want to think about moving to jQuery.

Integrating with WordPress

I probably should be working on the 2.7 upgrade, but instead I started looking at photo gallery options other than Gallery2. It is just too slow. There is too much of it I don’t use as well. I think I have settled on zenphoto. It seems to work pretty well, with out the feature creep that Gallery2 has. I figured I would convert the annieandchris.net site to that.

It got me thinking though about how I might integrate it with WordPress. After seeing the tantan Flickr plugin, and how well it works, I figured that there must be a plugin for zenphoto. Well, no. Not really. There are a couple that will let you show pictures in the sidebar. And Trung’s presszen looked promising, but it didn’t seem to work. I started taking a look at the code for the tantan Flicker plugin, and saw how he was able to take control of a URI to insert his own code in with the current wordpress theme. I stripped out the relevant stuff, and got it to work. This is the code.

function parse_query(&$query) {
	$query->is_404 = false;
	$query->did_permalink = false;
}
function request($query_vars) {
    $query_vars['error'] = false;
    return $query_vars;
}

function cww_template() {
	get_header();
	echo '

Zen Integration

'; get_footer(); exit; } define("CWW_ZEN_BASEURL", "/blog/test"); if (strpos($_SERVER['REQUEST_URI'], CWW_ZEN_BASEURL) === 0) { status_header(200); remove_action('template_redirect', 'redirect_canonical'); add_filter('request', 'request'); add_action('parse_query', 'parse_query'); add_action('parse_request', 'parse_query'); add_action('template_redirect', 'cww_template'); } elseif (strpos($_SERVER['REQUEST_URI'].'/', CWW_ZEN_BASEURL) === 0) { header('location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'/'); exit; } ?>

I think that I may take a go at pulling in the zenphoto albums in a plugin, and see how it goes. I like how you create plugins in WordPress, and it is kind of fun poking around. It was frustrating for the longest time when I was trying to get it going, and I was getting the body of the blog showing up at the bottom. I finally realized that I needed to ‘exit’ the script to prevent the loop from happening. You would think you could override a WordPress function to prevent that instead.

WordPress 2.7

So, no sooner do I have a bunch of new stuff added to the blog, than WordPress releases version 2.7. This is no small release. There are a bunch of things added that can break plugins and themes. Comments are upgraded, the admin interface is overhauled, and several new functions exist to support all this that need to go into the themes. There is a migration doc here. I will probably need to use it. The theme I am using is not yet on the compatability theme list, and I have customized it quite a bit. The The plugins I am using are not on the compatability plugin list either. I am a little nervous to upgrade at this time. I will probably need to install a “test” version of 2.7, and install my theme and plugins and see what I need to fix.

New Stuff Added

I have updated the site a bit. The About page got updated, and I added a new page called Books. I wanted to have a page where I would keep track of the books I have read, and a place where I could link to any of the posts I have made about these books. I also will put together a list of the books that have been recommended to me that I plan to read.

You may also notice that there is a blue space in the top header. I have some images that I need to update. Might be a good time to swap in some new ones. The reason for the gap is that I have made the blog content area wider. As I had blogged about earlier, the medium images from flickr didn’t quite fit. Now they do.

The new F150 Tonka

I have also found a really cool plugin called the Flickr Photo Album for WordPress. It is very cool. It does three things. First, there is a widget on the right sidebar that shows the last 8 flickr images I have posted. Second, it allows me to select a flickr image to insert (I did this with the Tonka Truck) without needing to goto flickr and get the url for the image. Slick. The third thing brings us to the menu changes. I have changed what I have up there, and there is a new tab called flickr. Clicking on that brings you to a page, still in the blog template that shows pictures from flickr. You have access to all the albums there. You can even initiate the flickr slideshow, which is a nice touch.

I don’t think I broke anything, but you never know…

WordPress Code Plugin

If you look at the tutorial I put up, you can see that the code snippets are syntax highlighted. Most of the java classes are initially hidden, but when you press the arrow to the right, the code slides down. Very cool. I found this WordPress plugin called WP-CodeBox. It works pretty slick.

One thing that I wasn’t completely happy with, was that there was no “name” to the code. The header for the top just looked like this:

code here

What I wanted was something like this:

code here

It took a bit of sorting through the code, but I found the section that parsed the parameters, and added a “name” parameter. Now I could add whatever text to the header I wanted, and have the name of the code stand out.

New WordPress to come

WordPress has released the 2.6 version a little while ago. Everything appears to be working fine here, so I haven’t felt the need to jump on the new release. I always worry a bit about a new version, but Ars Technica is saying that the new version is being downloaded at record numbers, with very few problems. I guess I should upgrade. I have made some changes, but I believe I was smart enough to only modify a theme.

Rotating Banner Image

I got around to creating the rotating banner images last night. I made 3 new ones, but they aren’t really my best images. I need to hunt round for some others. My flowers don’t really fit the landscape type space that is there, but I will have to see what I can do.

To make this work, I started out with some javascript in an onLoad function, but the image would blink with either the default image, or the background color. To fix this, I scrapped that idea, and went to an inline style block that is written out with a little php in the header.php file in the template folder.

<style type="text/css">
  #headerLeft {
    background-image: url(<?php bloginfo('stylesheet_directory'); ?>
        /images/header-img-<?php echo rand(1,4); ?>.jpg);
  }
</style>

This just gets a number between 1 and 4, and the base directory for the template, and sticks it all together to make the image. Presto. No more flickering.

Starting fresh.

The old blog software, Serendipity, has been replaced with WordPress. I just decided to switch with no particular reason that I can remember. I was going to upgrade, and just decided to switch. Try something new. I decided to ditch the old posts too. Nothing newer than a couple of years ago anyway.

What has got me going again is photography. I think I have something to say anyway. Check back and find out.