Adding The Sidebar To The WordPress Page Or Single Post Template
Some WordPress themes don’t show the sidebar on single posts or pages. If you are using the sidebar to monetize your blog you know how important it is to get your money makers as much exposure as possible.
The following also explains how to use a static front page for your blog in place of the normal blog showing your latest blog posts. You will also need to change the file permissions on your current themes template files in order to edit them.
Login to your hosting account, browse to your blog directory, open the wp-content folder, open the themes folder. Change the permissions on the current themes folder and all the files in it to 777.
Within the WordPress Reading subpanel under the main Options panel is where you start seeing the versatility of a WordPress blog. You can specify a static page or the normal blog of the latest posts. Posts and pages are different; when you write a post it goes into the blog Loop. Writing a page is static and doesn’t appear in the loop but is shown as a link somewhere on the WordPress sidebar.
If you choose the static page option be warned that some themes will not show the WordPress Sidebar on pages. If this is the case you can add the sidebar to WordPress static pages very easily.
Click on Presentation from the main panel and then Theme Editor. On the right side you will see a list of the current theme’s templates. If you see a “Page Template” (page.php) click that and the code will appear in the editor box. Copy all the code in the editor and paste it into Notepad for backup.
First you need to change the column width from wide to narrow to make room for the sidebar. At the top of the page.php or single.php file change the following code:
<div id=”content” class=”widecolumn”>
Change it to:
<div id=”content” class=”narrowcolumn”>
Now at the very bottom of the editor box you should see this bit of code:
</div>
<?php get_footer(); ?>
That is telling the page template to get the themes footer, what we are going to do is tell the page template to also get the sidebar. Replace the above code with the following code and click “Update File”.
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
If you don’t see a “Page Template” then try the same steps above with the “Main Index Template” but be sure to copy the unedited code first into Notepad or any other text editor so you can put things back if they don’t work. Keep in mind that all WordPress themes are a little different and made by many different people so the files in them will vary.
If the sidebar is not showing on single posts, the same process can be done on the single post template (single.php).
If you managed to corrupt your theme’s templates files and it’s not displaying properly or worse you can’t even see your blog; go back and paste in the unedited text you saved in Notepad and click “Update File” to put things back. What? You didn’t save a backup? Well then you will need to delete the corrupt file in your hosting account and upload an unedited version of it. Not sure what file you messed up? Man, you are a butcher! Then upload a complete unedited version of the entire template to your hosting account.
Knowing how to add the WordPress sidebar to a static page is a great way to use a specific landing page that doesn’t change yet still looks like the rest of your WordPress blog.
For the final step in this WordPress guide read this post:
Add Background Color To Single Page Sidebar On Default WordPress Theme
Similar Posts:
- WordPress To Run Your Website
- Choose WordPress Pages Displayed In Navigation Bar
- You Can Put Lipstick On A Static HTML Site But It Will Still Not Be A WordPress Site
- WordPress Or Blogger Is WordPress Better
- How To Really Screw Up Your WordPress Blog
If you liked this post, feel free to leave a comment that is relevant to the post or subscribe to the feed and get future articles delivered to your feed reader.
Sorry but due to the spamming of a few all comments are moderated and will appear when approved and all drive-by comments will be deleted!












Comments
Adding The Sidebar To The WordPress Page Or Single Post Template…
How to add the sidebar to the WordPress page and single post template and how to use a static front page for your blog in place of the normal blog showing your latest blog posts….
Hey Jeff — great information all in one place.
Thanks,
Heather
Reply
Jeff once again opens new methods of improving your web presence. This article shows you how to enhance the monetizing of your website. If implimented properly your blog can become an online ATM.
Carl Hendricks,
http://www.cehmagic.com/blog
Reply
One problem I’ve been running into is removing the sidebar from your front page when using a static page as the front page in Wordpress 2.2.
I believe what happens is the latest versions of Wordpress don’t respect a “page template” selected when editting the page you want to have be your front page, so even if I choose a sidebarless page template for my static page, it processes the static front page through the “single post” page instead of custom page template.
I found this to be the bug when I commented out the sidebar from my single post file and it removed it from my static front page.
What a headache…
Reply
Nick your issue may be theme specific, I had the same problem and was able to create a custom page template without the sidebar using some HTML along with just the header and footer.
See it here: http://www.wordpressmax.com/static
It took me a while and I think with this theme the sidebar was part of the header so I needed to create a custom header without the sidebar. Then use that header for my custom page template.
The custom page template I made does not get the content so that would need to be created within the HTML of the template.
But I think if I mess around with it long enough I could get the content to show as well.
Search over at http://mu.wordpress.org/forums/ for help, I know sometimes the answers over there are not very specific, and in order to customize one thing you may need to learn how to customize three things! Like in my case changing the header. But that is the best way to learn.
I think this will be an upcoming post as soon I as can get all the info together…
Jeff
Reply
[...] to use a static front page for your blog in place of the normal blog showing your latest blog posts.read more | digg story [...]
[...] for hours and what seems like second nature to the geeks actually drove me nuts! In a related post, Adding The Sidebar To The WordPress Page Or Single Post Template. In that WordPress Guide I explain how to add the sidebar to the single post page of the WordPress [...]
Thanks Jeff, this is exactly what I needed to know. But one thing you didn’t cover which will be helpful for others is that in the Kubrick theme I also had to change the column width, otherwise it added the sidebar at the bottom. So after editing the code you outlined above, I went to the beginning of the Single Post theme file and changed the following line:
to read:
Lucky guess on my part, but it worked!!
Reply
Weird, it deleted my code lines out of my comment. So basically it’s the 2nd line at the top and I had to change “widecolumn” to “narrowcolumn”.
Reply
Thank you very much, I have follow your instructions and my blog is working for now… :0
Reply
[...] why I am hardly to edit some css and php codes of my template. I keep on reading some different article on how can I fix this and here what I learn my sidebar to the single page is working for [...]
It worked like a charm – thanks for the tips.
Craig
Reply
Wow !
Great tips ,I’ll follow these tips .Hope such tips will be of great use to me.
Reply
Many thanks Jeff,
I am glad to find such useful information at a single platform.This information is a solution of my problem.Thanks again for solving my problem.
Reply
Oh, that is the case, I look for a long time did not find, thank you.
Reply
i’m using a sandbox template “veryplaintext” i want to make the sidebar appear, but i dont have that narrow – wide column part in the singlepost.php, (even though thats exactly what apening in the single post page)
weirder then that, it does have the ?get sidebar? code.
any idea what might be causing it not to show ?
Reply
Being horrible at wordpress I needed something like this to adjust a couple of my themes – thanks Jeff you rock!
Reply
Thank you very much. This really helped me with my work. I appreciate your help. Thanks a lot.
Reply
Thank you for tips! Now I can customize my template.
Reply
worked like an absolute charm!
thanks so much for this.
Reply
thx jeff your the nutz, great help
Reply
It works perfect, thank you!
Reply
Great, Thank you very much, I have follow your instructions and my blog is working.
Reply
Leave a comment
Drive-By comments will be deleted! Like "Thanks for sharing", "Nice post", or any other text that doesn't contribute to the discussion. If you ask a very specific question about your particular WordPress theme, it will probably be deleted. I can fix your WordPress site but for a price. If you ask a question like "Why don't my blog work right", it will be deleted. If you ask a question about your WordPress site without a leaving a link to it, it will be deleted. The point is to ask questions and or comment on the the actual content of the post, and to please use some common sense. All comments are moderated and will appear when approved. Thank you.