WordPress – How to make the sidebar show in posts and pages

I've always enjoyed using WordPress blogging software from the day I first installed it. It's simple to work with, is well structured and contains an easy to navigate admin menu. WordPress includes a default template called Kubrick that contains a great simple base design to work with.

However, after using the default Kubrick template for a while, I found the urge to make a few changes here and there. Not only was there desire to customize the look of my site and individualize it to suite my personality, but also the need to improve the functionality of the template.

One feature in particular that I felt was important and needed modification was the sidebar. In my opinion, the sidebar should be viewable on the post pages along with the main page. This way a visitor can navigate through the site with ease once they are done reading a post.

In the following, I'll explain the steps I took to add the sidebar to all posts and pages:

  1. The first step is to login to your administration panel.
  2. Click the Design tab from the admin navigation menu.
  3. Select the Theme Editor tab from the administration sub-menu.
  4. Now select the WordPress default theme within the theme editor window from the drop down menu under themes to edit.
  5. Find and select the single post theme file (single.php) from the WordPress default theme files to the right. You should now see Editing single.php at the top of the theme editor.
  6. Near the top of the file, find where it says:

    <div id="content" class="widecolumn">

  7. Change widecolumn to narrowcolumn so the code looks like the following:

    <div id="content" class="narrowcolumn">

  8. Now scroll down to the bottom of the file and find where it says:

    <?php get_footer(); ?>

  9. Directly above this add the following:

    <?php get_sidebar(); ?>

  10. Your final entry at the end of the single.php file should look like this:

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  11. Once edited, simply click the update file button at the bottom right and go view your site. You should now have a sidebar on your post pages.
  12. Note: You may also wish to remove the call to sidebar code from your 404.php error page. You can find it in the same way you found and edited the post.php.

Recommended Posts:

  • No Similar Posts Detected