For SEO reasons you may not want to add your blog roll to every page on your website, but sadly it’s not so easy to do on WordPress. Having the blog roll links on every page, can really zap your link juice, and overall such site wide links generally don’t help the sites you are linking to.
Here is a quick quide on how to list your blogroll links on your homepage. It involves editing one of your templates (Admin Menu > Appearance > Editor) and editing some wordpress code around where the Blogroll links are called. On the default Wordpress Theme (and probably your theme also) it can be found in the sidebar.php file.
<?php wp_list_bookmarks('title_after=&title_before='); ?>
Before you start to try and edit the template you need to make sure that you have uploaded the file so it can be edited.
Replace the code above with the following code:
<?php if (is_home()) { wp_list_bookmarks('title_after=&title_before='); } ?>
The is_home() function is an inbuilt wordpress function that checks if the page you are on is the home page, and if so it will display the subsequent code.
Note if you are using “widgets” (Admin Menu > Appearance > Widgets) to populate your sidebar, then this method might not work.
Some more advanced examples of listing blogroll links
<?php if (is_home()) { wp_list_bookmarks(); } else { wp_list_bookmarks('category=4'); } ?>
This example will show all bookmarks on the home page, and on all other pages it will show just links that are in the 4th category. You can find out the link category number by going to (Admin Menu > Links > Link Categories), then click on the category you want to be displayed. You will now see a URL in your browser that ends in &cat_ID=XX, where XX is the category number. In our example we will display category 4 on all other pages.
5.11.2009
I was trying to do something similiar over the weekend. I am looking to show different categories in the side bar based on what category you select.
So on my home page I might have the following categories on a side bar:
Dogs
Cats
Rabbits
Then if I click Dogs I get all posts tagged under that category but categories on the side bar also change to:
Big Dogs
Small Dogs
Medium Dogs
I know this isn’t the type of behaviour Wordpress was made for. But is something like that possible. Or even can I show different widgets under different categories.
Even taking your blogroll example, there are often a lot of things in the sidebar that don’t need to be there when looking at an individual post. I would strip away a lot of things at a post level.
5.11.2009
Hi Kieran,
You could probably do this, with something some conditionals like
if (is_category('9')){
wp_list_bookmarks('category=21');
} else if (is_category('10')){
wp_list_bookmarks('category=24');
}
// etc
where ‘9′ is your category about Dogs, and ‘21′ is you category about types of dogs.
I’m not 100% sure if this would work, but it is one possible approach.
Paul