Ooh, shiny.

It seems I’ve decided to at least work on the backend of the blog again, if not make a conscious effort to post more often (although I suppose that if I post about every update I make, that’ll at least be something).

I created a new blog for Heather this morning; check it out if you feel so inclined. Only one post so far, but there’s only so much that happens in one day, you know?

So. Theme updates; I moved from K2 (which I still really like) to Tarski. It’s one of the 9 themes on wordpress.org, so I’ll definitely need to change things like the header image, and possibly some of the font settings; I don’t want this site to look like hundreds of other new wordpress blogs that have just moved away from Kubrick.

I also created a bare-minimum plugin for this site which adds OpenID headers to the front page. I figured that manually editing header.php for every theme would rapidly get quite boring. It’s actually amazingly easy to write simple plugins like this. I doubt I’ll ever release the plugin for general usage; in its current state it’s very bare-bones and requires not only multiple manual edits to the plugin file to get it working correctly, but also requires a working installation of phpMyID.

And with that, I’ll be signing off.

Bah, back to basics

I upgraded to WordPress 2.3 a few moments ago, and as a result all of the themes I like seem to have broken. So it’s back to the Kubrick variant until I find time to write and/or steal a different theme.

Test of CricketMoods

I installed a plugin that gives me those silly “Current Mood:” lines on posts. So I’m testing it out. I’ll probably try it for a couple days and decide that this isn’t livejournal, and turn it back off…

WordPress Themes

WordPress 1.3 includes a “Presentation” section in the admin area; its use is to switch between themes that have been installed. But there’s currently little to no documentation about what themes actually are, and how they’re written, how they’re installed, and how they work.

I seem to have figured it all out. At least, I think I have. There’s still some robustness checking I should do, in case specific files in my theme aren’t present, but here are the steps I took to make what you see here into a wordpress theme.

  1. First and foremost, create the style.css for your theme. You will need to make specific additions to the top of the stylesheet page, specifically the following portion:

    /*
    Name:
    URI:
    Description:
    Author:
    Author URI:
    Template:
    Version:
    */
    Fill all of those fields out. For “Template”, put the name of the directory you’ll be installing your theme in. In my case, “Template” is “devlogic-condition”. This will enable wp-blog-header.php and other files to actually locate your theme files and use your custom index, header, footer, and sidebar files.
  2. Now, make a directory to hold the actual pages you use to display your site. This includes index.php, wp-comments*.php, wp-header.php, wp-footer.php, and wp-sidebar.php (if you’re basing your theme off of the new “modular” page layout). Copy all of the files you modified (or plan on modifying) to a new directory, and then make a few small changes. In your theme’s index.php file, you should ignore the warning at the top and delete the line “require(‘./wp-blog-header.php’);”. It’s already called by the master index.php file in the webroot, and I’m pretty sure that calling it a second time does nothing more than increase the page load time.
    Then, modify all of the php files you just copied, thusly:
    find all of the lines that use the include() function, and modify the arguments. Change
    include(ABSPATH . '/filename.php');
    to
    include(ABSPATH . "wp-content/${wp_template}filename.php");
    This makes the modular system load your custom header, footer, and sidebar files. It took me a while to figure that out, let me tell you.
  3. copy and/or move the directory everything’s in into your wp-content/themes/ directory, and make sure the dir’s name is the same as the value you entered for “template” in step 1.
  4. Oh, yeah. Once everything’s in place, go to the “Presentation” menu in wp-admin, and enable your theme. If everything worked correctly, you should be able to view your site with your theme instead of whatever was there before. The most dramatic way to see this actually work is to put your theme file into a fresh installation of wordpress 1.3cvs (or release, when it comes out); you will see everything with the nice “default” theme (or “Kubrick”, if it’s there), before enabling your own hard work (or your hacking of someone else’s hard work, whatever).

Yay! Fixed WordPress Paging!

Those nifty “next page” and “previous page” links at the bottom of the page finally work! Here’s how I fixed it. Well, actually, here’s the changes I made that corrected the problem. How I fixed it involved digging through PHP files for about half an hour.

It seems that with the WordPress 1.3 nightlies (and, I assume, the CVS and alpha versions as well), the “blogfilename” option in the wp_options table isn’t populated. I issued this statement in mysql_client to fix it:

update wp_options set option_value=’index.php’ where option_id=2;

and lo and behold: after a refresh the pages actually work correctly! Note: in my wp_options table, option_id 2 was also option_name ‘blogfilename’. If you’re going to try this, please make sure that YOUR option_id 2 is also option_name ‘blogfilename’. That, or use this statement instead:

update wp_options set option_value=’index.php’ where option_name=’blogfilename’;

Of course, I thoroughly suggest you make a backup of your database before changing anything. If you mess up your blog by trying this without checking what your current values are, I can’t be held responsible.

I’m sure there’s an option in the wp-admin section to enter this value appropriately (and if not, I’m sure it’ll be added soon), but I couldn’t find it.