WordPress stuff

I taught WordPress themes in my class last night. I’ve spent the last 10 weeks teaching these people HTML and CSS as best I can. I wanted to teach some practical stuff. The last class project was to create a custom web page using the CSS three column form. It had to be from scratch, so I added a few things that they could not do if they copied a template off of the internet. It had to be dynamic with floating left and right columns. I prefer this format and it is easy but not trivial. I wanted the class to be able to reproduce it without thinking too much.

The default WordPress theme uses a similar layout, but it is a fixed width rather than dynamic. This is not good for many applications. It wastes screen real estate and it does not scale with small screens (PDAs and Cell Phones) or large displays such as the new generation of LCD monitors.

What I did in the class was teach them how to grab a default WordPress layout and save it to disk and then fiddle with the style. You can create almost any WordPress theme off of the basic templates by altering the css file. I had them move things around, change the font and background and have a grand old time ruining the templates. (The CSS files are wacky and have multiple entries for each style. This discombobulates DreamWeaver MX, but I got the class through this hurdle.)

The next thing was to show how to fix up the four WP PHP files without destroying the presentation. This is harder because you can change some little thing and the php won’t compile. I taught them to make small incremental changes with backups so that it would be easy to fix mistakes. Most of the PHP is fairly obvious and I gave them a general method for identifying the parts and how to move them around or delete features, especially in the sidebar.

As I taught, I spent 45 minutes looking at crappy WordPress code and I can see how WordPress can be a dog. There are horror stories about how WordPress reacts to a DIGG or del.icio.us bookmark. A small amount of extra traffic will bring a WordPress site to its knees. There is entirely too much behind the scenes loading of files and accessing databases in WordPress.

The solution would be to rewrite the core PHP as a class and load it all at once, caching almost everything and hitting the db only once or twice per page. I don’t have the time to do anything like that. I don’t want to be the person to write another WP clone.

What I did do, is write a 20 line program that creates a static version of the home page based on the current index.php. I basically copy the index.php file to a static index.html file. It loads almost instantly. You run one program every time you publish a new post and the static page looks exactly like the old dynamic one, except for super fast loading. This applies only to the main page so that all the comments and other stuff still works. Any dynamic widgets, turn to static, but that’s not such a big deal unless you are addicted to dancing bologna on your pages.

I will use this on my WordPress installs from now on and I may even add it to the admin menu. I need to document it before it is ready for prime time. If you accidently find this page, give me an email heads up and I’ll point you to a zip of the file and a quick and dirty readme.