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. 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
Customize WordPress sidebar WordPress WordPress GuideIf you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Tagged with Customize WordPress, sidebar, WordPress, WordPress Guide
Related Posts
9 Responses to “Adding The Sidebar To The WordPress Page Or Single Post Template”
Discussion Area - Leave a Comment
If you have a question about your blog please leave a link to it. Please don't ask questions like "Why don't my blog work right?" and expect an answer.Two links or less are welcome, any more and your comment will be spammed! Nofollow has been disabled, all comments are moderated and will not appear until approved. Please submit only once.
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Or just copy the example below and change your details.
Example - <a href="http://www.YourSite.com">Title Of Site</a>










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
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
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…
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
[…] 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!!
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”.