Burningbird Technology Weblogging

Pithy bar

Sidebar quick links, or b-links are very popular now. I wasn’t that interested at first in them until I found myself wanting to point out items of interest, but without writing a great deal about the item. I don’t necessarily like doing little posts with nothing more than a link, so b-links really is a good alternative.

What especially sold me on the concept was Mark Pilgrim’s b-link implementation. I found his style to be non-obstrucive, but more, I really began to enjoy the little comments he would add as TITLE attribute with each link. We talk about the skill and effort it takes to write lengthy essays, but it takes an equal or greater skill to sum up your view or opinion in one pithy little statement.

A b-link compliment is a nice,elegant way of saying, “Look at what you’ve done”, rather than not saying anything at all. They’re also a great way of pointing out something that doesn’t need any additional words, for one reason or another; or of saying to another: I hear you. Additionally, I found that one can use a variety of tones, from snippy to snarky, in a this type of b-link and they don’t seem to come out as heavy as they would in a regular weblog posting. Rather than be deliberately and ponderously offensive, these types of little communications become more a caustic little jab, or even a joke between friends.

Perhaps this effect is just Mark’s way with pithy statements; or perhaps it’s the brevity of the statement and the nature of its delivery – it becomes more an aside whispered under one’s breath than shouted from the pulpit.

So, I decided I wanted b-links. Specifically, I decided with my weblog re-design that I want a Pithy Bar.

Now something like a pithy bar isn’t necessarily easy to do in any weblogging tool, WordPress or otherwise. They’re usually created as separate categories for sidebar linking; or a separate weblog and getting the entries from the database, or scraping the syndication feed for the links. These work well, but it was more than I wanted in my implementation.

I wanted to add a link and have it show–bang! That’s it. Clean and simple. So, time to break out the code.

I created a table called “linklog” and added it to my WordPress database. The table has the following fields:

id – autoincremented identifier
title – What shows with the link on the page
url – b-link URL
blurb – the aside that’s added to the TITLE attribute of the hypertext link
viaurl – If found through another site, a link to that site

All fields are type ‘text’ except for the id.

I next created a page called linklog.php, which I added to my wp-admin directory. This page has a simple form that checks to see that the values are provided when the form is submitted, and inserts a new row for each linklog entry into the database. It also displays the last five linklog items, just to make sure you don’t add the same one twice.

To have this page show up in my installation of WordPress, I added an item to menu.php to point to this page (highlighted):

$menu = array(
        array(__('Write'), 1, 'post.php'),
        array(__('Edit'), 1, 'edit.php'),
        array(__('Profile'), 0, 'profile.php'),

Finally, I created a WordPress plugin that has a function, my_linklog, that takes the number of links to display, and a special separator string that can be used between the items. The following is how I call the function in my main page:

my_linklog(10, ‘–. — — –. .-.. . / -.. ..- … -’);

By default, the number of items showing is 5, and the separator string is empty (‘’).

Each item that is displayed is wrapped in a DIV element, with a class name of ’sidecomments’. With this, an individual can then add whatever CSS they want to the display of each item. Once I added my CSS, and added the function call to my sidebar, underneath my comments in the main page, I was done.

A modification to this would be the ability to delete an item, but they’ll roll off anyway, and I think it’s better to just do the link and walk away.

I also don’t have a separate syndication feed for the Pithy Bar. I think of my Pithy Bar as this weblog’s easter egg – goodies you get if you click through, or know what to look for. When you stop by to read one of my longer essays, you can then check out any new entries in the Pithy Bar.

For those WordPress 1.2 users, you can download a file containing an edited menu.php, the logfile.php, and a page to create the table (install-linklog.php) . These three you install in wp-admin, and then run the install program once to install the linklog table. If you copy in the menu.php file, do note you’ll copy over your version of menu.php, so use caution. You can also just edit your version of menu.php to add this highlighted entry.

The gzipped file also has the plug-in, my-linklog.php, that you’ll need to install in your plugin directory (wp-content/plugins/). When you install it, you’ll have to go into the Plugins tab of WordPress, find the plug-in titled, “My Linklog”, and then activate it.

If you decide to add this to your version of WordPress, as always, backup your files and database before installation.

Print Friendly, PDF & Email