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.

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.

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).

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