Skip to content

Displaying Blogroll on a WordPress Page using Custom Page Template

2009 November 24
tags:
by Aaron

blogroll

On many WordPress blog setup the blogroll is displayed on the sidebar. Displaying blogroll on the side bar can cause us some problems. If your blogroll is very long it will occupy valuable sidebar space. In addition displaying your blogroll on the sidebar in every page can dilute your Google Page Rank because it increases the number of outbound links on every page. Therefore, I wanted to move my blogroll from the side bar to a WordPress page.

For the non-technical person the easiest way to achieve this functionality is to manually create a blogroll page. Another solution is to use a plugin such as the Blogroll Plugin that will allow you to embed the blogroll on a WordPress page. Using the plugin relieves us from the task of manually editing the page each time you have a new blog on your blogroll. But, if you are like me and want to keep the number of plugins in your blog to a bare minimum the best way to solve this issue is by using a Custom Page Template.

The Custom Template solution does require a little bit of coding effort, but it is a very clean and simple solution.

Steps

1. Go to the template directory and copy the file name page.php to blogroll_page.php

2. Edit blogroll_page.php and insert the following code at the top of the file

<?php
/*
Template Name: Custom Blog Roll Page
*/
?>

3. Search for the line following line of code in the blogroll_page.php file

<?php the_content(); ?>

and add the following code below it

<ul>  <?php wp_list_bookmarks('title_li=&categorize=0'); ?>  </ul>

The the_content() function is responsible to display the contents of a page. After the page content is displayed we are displaying the blogroll using the command wp_list_bookmarks function.

4. We are done coding and now you can save the blogroll_page.php file

5. Log into WordPress and create a new page. Give it a title name. For example,  “Links”.

6. If you want to display any text above the blogroll you can type it in the page contents. Please note that the function the_content() is always called before displaying the blogroll. If you just want to display only the blogroll leave the page contents empty.

7. In the edit page you will see a drop down named template. Select “Blog Roll Page” as your selection.

8. Save the page, Voila! You are done. Your blog role will now appear on the page titled “Links”.

9. Now you need to remove the blogroll from the sidebar widgets. If your theme does not support widgets you may have to get rid of the blogroll code from the sidebar.php file.

I hope you find this article useful. Do you know another way to display blogroll on a WordPress page? Please share it in the comments section.

Photo Credit: just_a_name_thingi e’s photostream

4 Responses Post a comment
  1. March 21, 2010

    Thanks for the post. One thing though: this code did not work for me until I removed the parameters (‘title_li=&categorize=0′).
    Cheers

  2. Aaron permalink*
    March 21, 2010

    @Adal Design, Thank you for letting me know. I’ll double check the code.

  3. December 9, 2010

    Hi
    Greate guide. Worked perfect for me.
    Keep up the good work.

    /x-tra

  4. Rob permalink
    April 10, 2011

    Sorry, but these directions are pretty poor. I have tried following them.

    It says:
    1. Go to the template directory and copy the file name page.php to blogroll_page.php
    Does not make sense. Do you mean copy the contents of page.php to blogroll_page.php? In what directory does blogroll_page.php go? And where is the template directory?

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS