Get More out of WordPress Link Categories

UPDATE: August 1, 2013

The WordPress Links Manager has since been depreciated. Any virgin installments newer than 3.0 won’t have it, but you can add the feature back with the Link Manager plugin.

ORIGINAL POST:

The WordPress platform comes with an intriguing – yet often neglected – link managing feature in the Dashboard menu called Links. What’s intriguing is the potential power of this feature, particularly with respect to Link Categories. I emphasize potential power because it’s stock usage is currently limited to a sidebar widget. As Lanexa.net has recently been tasked with redesigning a site that maintains a substantial amount of external links, this article will demonstrate an easy way to increase the functionality of the link managing feature – by creating a landing page for your Link Categories (a.k.a. Bookmarks), which can be accessed from your main menu.

Step-by-Step

1. Create Desired Categories. In the WordPress Dashboard, go to Links > Link Categories to create the Name & Slug of the the categories you will be using. It’s not important to complete this step right away, but you’ll want to get a few things in there so you’ll have something to display further on.

2. Decide which Page Template to Use. This example will use the theme’s default template called page.php. If you’re working on a live site and don’t want to risk screwing something up, you can copy this template file and rename it, i.e. page-bkmrks.php.

3. Create the Landing Page From the Dashboard, add a new page and title it what you will, i.e. Bookmarks Lading Page. Select the template you will be using and save the page. Make note of the permalink url, underneath the title, before leaving the page. I recommend using pretty permalinks, for added convenience (and a million other reasons).

4. Edit the Template. Good code-editing software – such as Coda – will allow you to log on to your server, locate the active theme folder, duplicate & rename the appropriate file (if necessary), and open it up for editing. All you have to do now is insert this simple hook into the content div:
[code]
<?php
if (is_page(‘bookmarks-landing-page’)) {
wp_list_bookmarks();
}
?>
[/code]
Note: Using pretty permalinks allows me to select the page by title.

5. Visit Your New Bookmarks Landing Page. You will notice that all your bookmarks are displayed on the page, organized under their category titles. If this is all you are looking to do, you are free to add this page to your main menu like you would any other. For more advanced options, read on (or search “wp_list_bookmarks“).

6. Select which Categories to Display. You can modify the above code in order to customize which link categories will be displayed on which page:
[code]
<?php
if (is_page(‘bookmarks-landing-page’)) {
wp_list_bookmarks(‘categorize=1&category=2,5’);
}
?>
[/code]
Note: categorize=1 will list the links beneath their corresponding category title, while categorize=0 – also categorize= (no value) – will list links under the general heading Bookmarks.
Note: category=2,5 calls the desired link categories by their ID numbers. A category’s ID number is revealed in the URL while editing it from the Dashboard.

Or, perhaps it makes more sense to exclude a category from the list:
[code]
<?php
if (is_page(‘bookmarks-landing-page’)) {
wp_list_bookmarks(‘categorize=1&exclude_category=3,4,6’);
}
?>
[/code]
7. Display Different Categories on Different Pages. Create as many pages as you want (using the same template) to display as many different category combinations as you want. All you need to do is stack these conditional statements, one after the other:
[code]
<?php
if (is_page(‘bookmarks-landing-page’)) {
wp_list_bookmarks();
}
?>

<?php
if (is_page(‘bookmarks-landing-page-2’)) {
wp_list_bookmarks(‘categorize=0&exclude_category=3’);
}
?>

<?php
if (is_page(‘bookmarks-landing-page-3’)) {
wp_list_bookmarks(‘categorize=1&category=3,4,8’);
}
?>
[/code]
Note: A complete list of parameters is available in the WordPress Codex.
We hope to develop this functionality into a Plugin in the coming months. Until then, i hope you find this solution to be an easy-to-manage alternative.

Using .html in WordPress URLs

A great jazz drummer & friend of mine has a site with a beautiful custom design, yet he was having to rely on computer nerds to manage his content. After helping him with a few seemingly simple updates, it was obvious that his money & my time would be better spent enabling him to gain control over his content, so I offered to set him up in WordPress. The migration moved swiftly until hitting one snag – his custom Flash menu is hardwired with page links that use .html. Why use a Flash menu in the first place? Good quetion! But I can’t argue that it doesn’t look great, and he seemed intent on leaving the design as is.

Fortunately, 99% of this problem can be solved with a simple plugin – .html on Pages. Not only did it quickly enable the old links, it also saved me the trouble of setting up a bunch of redirects, which would have been necessary if using wordpress’ default URLs.

The final problem was with the Home page link. The Flash menu’s “Home” link is hardwired with index.html, and needed to be redirected to index.php. The solution for this is actually quite easy, as well. With hidden files turned on, locate the .htaccess file within the wordpress folder, installed on your server. Just insert this bit of code above anything else:
[code]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html?$ / [NC,R,L]
[/code]
View the results and check out some incredible music at timdrums.com.