Email This Post
How to add a sidebar
Wordpress, Blogging Tips September 5th, 2007
Visited 746 times, 1 so far todayI’ve had a few people asking how they can add a second column sidebar to a one column wordpress theme. To do this you will need to edit the template files index.php, archive.php, page.php and single.php.
Here is the code with step by step instructions. Before you begin you will need to decide where you want the sidebar.
- Login to your Wordpress administration panel
- Select Presentation ->Theme Editor from the navigation menu
- On the Theme Editor page, you will see a list of “theme files” to the right of the page. Select the “main index template” (index.php).
- Copy and paste the following code before the last </div> of the <div id=”primaryContent”> and before <?php get_footer(); ?>. This will ensure the sidebar appears above the footer.
<?php get_sidebar(); ?> - Save
- Still on the Theme Editor page, select the “sidebar template” (sidebar.php).
- Add the following code after the last </div> of the left or right sidebar
- <div class=”right-sidebar”>
- Save
- Now open the style sheet (style.css) and style it up how you want it to match the theme. For example
.right-sidebar {
 width:190px;
 right:5px;
The best thing to do is to see how your other sidebar is styled and copy that code just changing the left or right wording. - Save
You can view your site now and you should be able to see the new sidebar added to your main home page. You need to now repeat the above steps 1-Â 5 on the following template files:
archive.php - this will show the sidebar on all your category pages
page.php - this will show the sidebar on all your pages you create in Wordpress
single.php - this will show the sidebar on every single post
That’s it your done! Feel free to comment if you have any questions.













[ # 1414 ] Pingback from The Sharing and Caring of the WordPress Community Shines « Lorelle on WordPress [December 24, 2007, 12:38 pm]
[…] Bloggerholic - How To Add A Sidebar To Your WordPress Blog […]