August 28th, 2005

WordPress 1.5.2 Broke My Site

So, WordPress 1.5.2 was released recently — good news, right? Normally, yes :). By the sounds of it, this was mostly a bugfix/security release, but it sounded like a good idea. I went through the upgrade process this afternoon and things seemed to be ok, at first. After uploading the new files, I loaded the home page and it seemed fine.

I should have tried something more involved than just loading the home page — as I discovered a bit later, any link within the blog would just show the home page’s entries again. Or, put another way, suppose that the home page hypothetically has three entries, “A”, “B”, and “C”. If I were to click on the permalink (the title) for “A”, I should see just that entry, plus the comments box and any existing comments. However, after doing so, I just saw the same entries as if I was on the home page (“A”, “B”, and “C”) even though the URL was that of entry A’s permalink (/archives/yyyy/mm/dd/post-name/).

Other pages within the site acted similarly — even a search query would return the same entries as the homepage. Interestingly enough, the sidebar did say “You have searched the archives for…”, as if I had done a search, so it wasn't literally showing me the home page again. Not sure what to do at this point, I took the Windows approach — a restart; I went through the upgrade process again, being careful to disable my plugins beforehand, delete the old files before uploading the new ones, and running the upgrade script afterwards. Still, I had the same result.

I was a bit cheesed off at that point and I wasn't sure what else I could try. As a last idea, I tried rebuilding my .htaccess file (in Options → Permalinks) but that had no effect. In the end, I just downgraded back to 1.5.1.3. And, everything is fine again. All that aside, I don't want to give the impression that I have anything less than complete respect for the WordPress team — their work is top-notch and they have a great product. For all I know, maybe this was a typo in the code somewhere or perhaps a small mistake on my part.

August 14th, 2005

Found a Tag Cloud Plugin for WordPress

I’ve been able to use more specific categories with my posts since installing the Cat2Tag plugin for WordPress. In short, it adds a text field below the textarea on the “Write Post” page where you can enter a comma-separated list of categories for the post. And, if a category doesn’t already exist, it’s automatically created for you.

One benefit to having more specific categories is more relevant categorization within Technorati. Each post in Technorati is listed by its tags and it assigns those tags based on the categories into which the post was placed. (Or, from the technical perspective, Technorati reads your RSS and extracts the categories from there.)

Anyhow, Cat2Tag has been working nicely; the only downside is that a regular list of categories could be a bit on the lengthy side. So, I’ve made use of Christoph Wimmer’s Heat Map Plugin for WordPress which you can see in the sidebar. The effect, also called a tag cloud, lists the categories sequentially but assigns font sizes based on the number of posts in each category.

I'm pleased with how the Heat Map Plugin worked out and Wimmer was thorough in his implementation. For one thing, rather than arbitrarily using pixel-based font-sizes, one of the function's parameters is a font-size unit — so, you can have it specify the sizing in ems, percentages, pts, or even inches.

And, as is common for WordPress plugins which “get data from the database and output it”, the function also allows you to specify code to insert before and after each link; so, if you set that to <li> and </li>, you can have a semantic unordered list (for those who aren't using a visual web browser).

May 16th, 2005

Prevent Lost WordPress Posts

You may recall an entry from a couple weeks ago about pretty URLs in WordPress. As it turns out, I ended up writing that entry twice. It wasn’t that I didn’t like the first version, but I just accidentally closed that tab in Firefox at the time (oops). I meant to click on the right-most tab in my browser but I instead clicked on the “close tab” button right there instead. Poof!

I was a little bit annoyed but there wasn’t much I could do about it. I wrote the entry a second time and I later looked around to see if there were any utilities which might help prevent that kind of thing in the future. One that I thought to look for was some kind of “undo close tab” extension. Well, ask and ye shall receive — a guy named Dorando created an extension called Undo Close Tab (how apropos). And, if you'd normally be wary of downloading an extension from a forum post, rest assured that he has a home page for his extensions as well, though the bulk of the information on Undo Close Tab is in his forum post.

I then took aim at the second thorn in my side, that dumb close-tab button which foiled my plans earlier. After all, even though an undo-close-tab extension would have saved me from the predicament last time, I wouldn’t have even been in that scrape if it wasn’t so easy to hit that button ;). Fortunately, that’s easily done as well. This MozillaZine Knowledgebase article writes about moving the tabbar (to the bottom of the browser or elsewhere on your screen) but it also includes the steps on removing the close-tab button (regardless of whether you want to move the tab bar as well). In short, you can remove your close-tab button but shutting down your Firefox and adding these lines to userchrome.css:

/* remove the close-tab button */
.tabbrowser-tabs > stack {
display: none;
}

Your userchrome.css file goes in your Firefox profile directory but the file doesn’t exist by default. Rather, there’s an example file called “userChrome-example.css” which you can Save-As to userchrome.css and make use of that. And, that previous link on the profile directory offers some tips on where your profile directory is located; that information is fine, though you may find it just as easy to just search your drive — starting from C:\Documents and Settings\ — for “userChrome-example.css”.

I felt better after getting those Firefox bits in order, and I then came across a WordPress plugin which also looked helpful. Gregory Wild-Smith wrote a plugin called Twilight AutoSave which “uses cookies and JavaScript to save the data you are typing and allow you to restore it (or delete it) later”. With that and the Firefox goodies in place, I should have a lesser chance of losing my posts next time. Not that I’m going to tempt fate, but I do have some peace of mind about it now.

April 21st, 2005

Pretty URLs in WordPress

If you’re a new WordPress user, you may have noticed that some WordPress blogs have “pretty URLs” with the date and the name of the post in the path. It’s not hard to set it up and you can have URLs such as “yourdomain.com/archives/2005/04/21/post-name/” . (In addition to the aesthetics, this also lends to higher search engines rankings as search engines consider a link’s path relevant.)

So, how does it work? Well, “permalinks” are set up through the options in WordPress and all the magic happen behind-the-scenes through virtual URLs on the server (so don’t worry about having to create all those directories manually). But before setting the options, you’ll first need to prep a file which is called “.htaccess” (yeah, it’s a a filename with only an extension, which probably seems weird if you're running Windows). You’ll need to make sure that it exists on your web host and, if not, you’ll need to create a blank version first…

To do that, log in to your web host (such as with ftp or ssh) and check to see if a file called .htaccess exists in your web root (which is the directory on your web host corresponding to the root directory of your domain). And, if the file is already there, you can skip the next sentence. But, if not, no worries — just create a blank version of the file (such as by opening Notepad or TextEdit and immediately saving it without typing anything) and upload that to your web root. And, with the file in place, you’ll need to set its permissions to 666 (which is probably done through the context menu of your ftp client with an option called “permissions” or “chmod”).

After that, you'll need to load the WordPress admin interface (at www.yourdomain.com/wp-admin/) and go to Options -> Permalinks (or just go directly to the URL www.yourdomain.com/wp-admin/options-permalink.php). There, you’ll need to enter what structure you’d like for your permalinks, which most people set to include the link’s date and post name along with an optional prefix directory such as “archives”. That’s a format that I like and if you’d like to use that, just enter this in the Structure field on that page:

/archives/%year%/%monthnum%/%day%/%postname%/

Then, it's just a matter of clicking the submit button on that screen (which, on my WordPress setup reads “Update Permalinks”, but it might read slightly differently on yours). And, if you're running WordPress 1.5, that should be all there is to it. However, if you’re using WordPress 1.2, you may be presented with a block of text for your .htaccess file; in that case, just copy-n-paste that into the empty .htaccess file on your hard drive and upload that to your web root. Either way, WordPress will let you know if this step is necessary — so, if you hit the submit button and you’re not presented with a block of text, then you don’t need to worry about it.

If this didn’t work out for you, I’d first recommend checking that the permissions on your .htaccess file were set correctly. And, if that looks good, I’d check to make sure that your web host offers mod_rewrite (which is the Apache that provides all this permalink goodness). There’s also a section on permalink troubleshooting in the WordPress wiki. But, don’t let this paragraph scare you — chances are, it’ll work just fine :).

April 10th, 2005

Getting strtotime() Errors in WordPress When You Try to Write Pages?

I was getting some odd errors when I tried to write a new Page in WordPress (even though it endedup working). “Pages”, if you aren’t familiar with them, Pages are static pages within your site such as a Contact Me page or an Accessibility Statement. Anyhow, I discovered that if you try to create a new page — and if you're running PHP5 — you get this error:

Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in /home/username/public_html/wordpress/ wp-includes/template-functions-links.php on line 55

There’s a bug report on this issue and it’s already been fixed. Well, it's been fixed in the codebase and it’ll presumably make it into the next release of WordPress (1.51). But if you want the fix now, you can modify edit-page-form.php on your own; it’s just a two-line change and you can copy-n-paste the new lines from the changeset attached to that bug.

April 4th, 2005

Adding Link Manager Tags to Your WordPress Templates

It's fairly common — well, almost universal — to feature links to your friends’ blogs in a sidebar of your own blog. And, WordPress has a “Links Manager” which makes this even easier (if you’re already running WordPress, you can get to this via the “Links” option across the top of the admin interface). The Link Manager provides an interface for adding and categorizing links; you can set display properties for each category, including how many links to display, whether to display a description, and how to sort the links (such as by name or even random order).

Say you want to add a blogroll to your site. There’s already a “blogroll” category by default and you can add or delete links as you like. Then, it’s just a matter of adjusting your templates to display the links in your sidebar. Now, depending on which theme you're using, this may happen automatically. But, if not, it’s not hard to edit your templates to have it do that.

The WordPress wiki lists plenty of Links Manager-related tags (well, five tags, but you might think that there’d be only one, “display links” or something). They’re actually very similar, and are largely separated based on whether they follow the settings in the Link Manager or whether they override those settings, and whether you need to specify the output-category by-name or by-category-number.

  • get_links_list — This disregards the settings in the Link Manager and displays links from a number-specified category.

  • wp_get_links — This follows the settings in the Link Manager and displays links from a number-specified category.

  • get_links — This displays links from a number-specified category and allows the user to customize the output of the tag.

  • wp_get_linksbyname — This follows the settings in the Links Manager and displays links from a name-specified category.

  • get_linksbyname — This displays links from a name-specified category and allows the user to customize the output of the tag.

Unless you’re using a PHP-based code to feed numbers in, it’s probably easiest to make use of the tags which support categories specified by name. So, I’ll focus on the two tags which support name-based category references (“wp_get_linksbyname” and “get_linksbyname”). And, chances are, you’ll want to go along with the settings which you applied in the Links Manager, so you can use “wp_get_linksbyname” for that.

To make use of that, just open up your sidebar file (sidebar.php) and add a reference to that line, enclosed in <ul></ul> tags. Assuming that the category you wanted to display was “Blogroll”, the code could look something like this:

<ul>
<?php wp_get_linksbyname('Blogroll') ?>
</ul>

You may also want to add an additional header above that as that code only produces the list itself. You can follow along with the surrounding code within your sidebar.php — it’s probably an <h2></h2> tag or such. That’s it — just upload your new sidebar.php to your appropriate theme directory.

Footnote: Apparently — if you’re using get_linksbyname — you can set a parameter so that it includes each link’s update time next to the link (based on its most recent ping to Ping-o-Matic). And, if you set the sorting to [last] updated, you can have your friends’ blogs listed in the order that they updated along with the time that they updated.

This all sounds nifty, but I haven’t had any luck getting that to work. I tried the no-www fix and I manually ran /wp-admin/update-links.php, but I just couldn't get the update-times to show up. So, I’m just making use of a random listing for now. But, I’m open to any ideas there.

March 25th, 2005

I’ve Switched to WordPress

As you may have noticed, I’ve switched to WordPress. Now I must go to bed or I’ll be tired at work tomorrow ;).

PS: There's a WordPress Meetup on Saturday at 4:00pm which I’ll be attending, natch.

February 13th, 2005

WordPress 1.5 Coming on Tuesday?

Matthew Mullenweg, one of the lead WordPress developers, announced a WordPress 1.5 upgrade party in San Francisco on Tuesday (with the note that he “had originally planned for it to be Monday”).

Tuesday, Feburary 15th, from 6-11PM, I will be hosting an upgrade party for people interesting in moving their blogs to 1.5. There will be food, drink, and wi-fi, so bring a laptop or your account details and get your blog on the most advanced blogging software in the world. You can upgrade from any previous version of WordPress or any other platform we have an import script for. […]

Of course, this prompted many to ask in the comments whether that meant WordPress 1.5 was being released on Tuesday (or Monday). And Matt just played it coy, saying that “1.5 will be released when it’s ready, no sooner and no later. :)” Well, it’s commonly known that WordPress 1.5 is just about done, so maybe it’s coming out after all.

And I, for one, welcome our new open source blogging software overlords.

January 21st, 2005

WordPress Meetup Tomorrow

There hasn't been a WordPress Meetup in a while (and I’ve never been to one) but it looks like they’re trying to get that started again. As a future WordPress user, I’m kinda looking forward to it — the Dallas Meetup is going to be tomorrow at 4:00pm at the Starbucks at Custer and Renner.

And apparently Ryan Boren will be there as well (he and Matthew Mullenweg are the two lead developers). Ryan also goes over some of the topics up for discussion in his blog entry about the Meetup ;).

The top secret release date for WordPress 1.5 will be revealed, and free “Licensed to Press” stickers will be given to those who agree not to gripe about nofollow. (Yes, I’m joking. No release date and no stickers for you.) […]

So, it looks like the official word is ixnay on the eleaseray ateday. All the same, it could be cool to get up to speed on all the new features going into WordPress 1.5 (and, yeah, they’re jumping from 1.2 to 1.5 because of all the changes since the last release).

January 16th, 2005

I’m Still Switching From Movable Type to WordPress

I recently wrote a comment on Ask.MetaFilter, the gist of which is that I plan on switching this blog from Movable Type to WordPress (probably with the next major WordPress release, to save myself at least one upgrade cycle).

And, Anil Dash — the vice president of Six Apart, the Movable Type company — saw my comment and e-mailed me personally to ask why I had decided on that. Though I’ve e-mailed him a reply as well, I’m posting my response as an open letter here, in case other bloggers are considering the switch to WordPress.

Hi Anil,

Fancy running into you on the InterWeb. And, I believe we’ve met before at SXSW — I’ve played kickball both in ’03 and ’04 :). I also found a picture of me from the SXSW 2004 moblog.

I’m still planning on switching to WordPress and it’s primarily due to Movable Type’s new licensing. Sure, I can use 3.x for free as I limit my blog to one author and three or fewer blogs — which currently is the case — but why not switch to a publishing system without those limits, in case I want to add another author or a few extra blogs sometime later?

I think my thoughts on this are summed up well in DiveIntoMark’s essay "Freedom Zero":

“I do not have the freedom to run [Movable Type] for any purpose; I only have the limited set of freedoms that Six Apart chooses to bestow upon me, and every new version seems to bestow fewer and fewer freedoms. With Movable Type 2.6, I was allowed to run 11 sites. In 3.0, that right will cost me $535. […]”

Continuing along those lines, I can’t be sure that Movable Type 4.0 won't limit free use to one author + one blog — or even start charging for non-commercial use in general. Now, I take to heart that Six Apart is one of the most non-evil companies around and that such a scenario may be unlikely; but that’s not to say that it couldn't happen.

Anyhow, Anil, please don’t take this as anything against you personally. I’ve had a great time playing kickball every year and if you’re ever in Dallas I’d be happy to take you out for a beer (HHOS).

--
Alex Bischoff