Load Up Your Blog Roll Without Overloading Your Blog.
Most bloggers accumulate a lot of links over time. There are social networking sites and blog community sites all over the place, and you just can't help finding more and more blogs that you want to recognize. The problem is that there is only so much you can put on a page, and there are so many things vying for space, so you end up making compromises.
Some people just dispense with the blog roll altogether, others limit it to appearing only on the index page and some move it to it's own page. Some people even just limit their blog roll to the point of not listing blogs they would like to list.
But what if you want to be free to load up your blog roll, load links to great blogs on all or most of your pages and still not have your entire blog taken over by a huge link list?
That's what this post is all about.
The plan here is to just add links to your Blog Roll category as you please, display a few of them each time a page is loaded, and the invite readers to click through to the actual blog roll page where you display them all.
This is the code I'm using to display five random links from my blog roll in the sidebar on the index page and the individual post pages.
[php]
Blog Roll
-
< ?php get_links(2, '
- ', '', ' - ', FALSE, 'rand', TRUE, FALSE, 5, FALSE, TRUE); ?>
- See the full blog roll
[/php]
Line three is the workhorse here. Let me break down all of the parameters in the get_links() function call.
- 2 - This is the id of my blogroll category.
- '<li>' - Before each link there is a list item tag.
- '</li>' - After each link is a close list item tag.
- ' - ' - Between the link title and the link description there is a dash
- FALSE - Any images associated with the links are not shown.
- 'rand' - Links are sorted randomly.
- TRUE - Descriptions are displayed.
- FALSE - Ratings are not displayed.
- 5 - Display is limited to five links.
- FALSE - Updates are not displayed.
- TRUE - The output from the get_links() function are echoed (displayed directly).
This puts five randomly selected links in an unordered list and displays them with their descriptions. Line four adds a sixth line item to the unordered list with a link to the blogroll.
Next we need to make a page to hold the full blogroll.
To accomplish this I first made a copy of my index.php template file. I gutted out all of the WordPress loop so that the page just contains the header, sidebar, footer and div elements of the layout. In the place of the loop I inserted this code.
[php]
-
< ?php get_links(2, '
- ', '', ' - ', FALSE, 'rand', TRUE, FALSE, -1, FALSE, TRUE); ?>
[/php]
As you can see the only difference here is that instead of showing '5' links I have '-1'. This tells wordpress to print all of the links in my blogroll category.
At the top of the file I added this code which simply gives this template a name.
[php]
< ?php /*
Template Name: Blog Roll
*/ ?>
[/php]
Now I create a new page (not a post) in the WordPress dashboard. I name it blogroll, and selsect the 'Blog Roll' page template. I recommend turning off comments and ping backs, and other than that don't add anything to the page. Just publish it.
Then add the url to this new blog roll page to your sidebar blog roll and you are done.
Now you display 5 random blogroll links in your sidebar and all of your blog roll links at once on your blog roll page.
If you aren't sure whether you want to move the bulk of your blog roll to it's own page, check out this post by Andy Beard on why you don't want a huge blog roll on every page of your blog.
Trackback URL for this post:
Bookmark & Share: Click, Copy and Link:








[...] love to the blogs they
[...] love to the blogs they read regularly. I don’t - yet. I’m planning to create one and display 5 random links in my sidebar, but for the moment, here is a list of the blogs I [...]
Jayne and ONwebCHECK ,
Jayne and ONwebCHECK , you're welcome, glad you liked. ;)
Dana,
You have two choices here. First you could call this function once for each category you are using, and this would allow you to put them in separate columns or otherwise label them differently.
Also you could use the one display for all of the categories you want to use. In the example above my blog roll category is 2. The first parameter in the function is the category you want to use. If you were actually using 2, 5 and 6 as different blog rolls, you could include them all in the display by putting them between quotes and separated by comas in like this "2,5,6".
Interesting idea. I happen
Interesting idea. I happen to have 3 or 4 different categories for links/blogroll on most of my blogs...that wouldn't cause an issue would it? Would I just go through the process above for each category of links?
Thanks for the idea!
I see, I learn somthing new
I see, I learn somthing new for today. THX for some helpful information.
Very helpful hints here!
Very helpful hints here! Thanks for sharing!
Post new comment