Ask me a question at the Wordpress Ninja Forum
Wordpress Theme Customizations - Removing The Sidebar Altogether
Posted on August 12, 2008
Filed Under Wordpress Solutions |
Hi everyone, almost forgot to add this important frequently asked question about Wordpress Theme layouts - how do i remove the sidebar altogether so it is just a single-column, no-sidebar theme. Maybe you found a great SEO optimized Wordpress theme but you don’t want a sidebar?
Here’s what we need to do.
First step is to delete the sidebar ‘include’ code from every page that references it. The typical pages are all located in wp-content/themes/<your theme name>/ and are as follows
- index.php
- page.php
- search.php
- archive.php
- single.php
A good way to find out for sure to be guaranteed of the sidebar not popping up somewhere where its not is to do a search in windows through each of those file for the following string
<?php get_sidebar();?>
NB: when doing a standard Windows file search (search string within files), you may need to force windows to include some file types - if you know for a fact that a search string exists within a file but the search does not find it then check out this article.
Upon removing the sidebar code from all files where it appears you will find that there will be no sidebar anymore in your theme but now your site layout will look all wrong because the size of the ‘content’ column will be too small and not centered.
To fix this you need to then go into the style.css file and expand the width of the content container to the full size of the page container, encompassing the blank space that the sidebar used to take up e.g. #container may have width of 960 pixels, but the #content container has width of 460 pixels. Change the #content width to be 960px and check padding and margins don’t blow the size out more than this - see my previous post on layouts for more info on this.
That’s all there is to it, you now have a single-column theme, which consists of a header, main body and footer and no sidebar.
Comments
16 Responses to “Wordpress Theme Customizations - Removing The Sidebar Altogether”
Leave a Reply
Related Posts:
Hi, i am the Wordpress Ninja. My name is Paul and my goal is to be able to answer everyone's Wordpress questions (for free) and post the best solutions on this blog. So for all questions and issues please post in the
great article. how about removing the sidebar on one particular page? specifically, I’m using andreas’ 1024px theme and the page I want to remove it from won’t be listed in the table of contents.
Jay,
you could use a conditional statement like this in the
page.phpfile:< ?php if ( !( is_page('xx') ) ) { ?>< ?php get_sidebar(); ?>
< ?php } ?>
This code should be placed surrounding the existing sidebar include statement (e.g.
< ?php get_sidebar(); ?>) and change the xx to be your page ID that you dont want the sidebar for. You can find the page ID by hovering over the page link in Admin>Manage Pages and checking the url at the bottom of the browser - the page ID is the last number of the url.This code basically says ‘if this page being loaded is NOT page xx then DO include the sidebar’.
cheers,
Paul.
Yes, but what about after using that code, there is still a spacer where the sidebar used to be. How do I remove that space on only that one page which was excluded from displaying the sidebar?
That’s cool!
@Paul the !(is_page… thing was exactly what I was looking for. Thank you!
No problem
Hello!
I made this all suggestions but nothing happen…
[...] Wordpress Theme Customizations – Removing The Sidebar Altogether | Wordpress Ninja Comments0 Leave a Reply Click here to cancel [...]
I have the same question “Yes, but what about after using that code, there is still a spacer where the sidebar used to be. How do I remove that space on only that one page which was excluded from displaying the sidebar?” adding— i want to expand the size of my content in that certain page.
Thanks
What if I have a theme with 2 sidebars and I want eliminate one of them? Seems to me that this fix will remove both of them.
I love the theme - just only want one sidebar.
dt
I have the same question… how to address the spacer or enlarge the column width only on the page with the custom template.
Wow!
Great instructions! Fantastic. Thank you so much.
Janet
themigrainediet.com
hey VVP ninja u have given me a exact solution well u r from VVP Engg Rajkot??
me From SCET surat
Fantastic article - easy to follow and EXACTLY what I needed - Thank you =0)
In the face before you, I really saints on earth if there is doubt; And now, I finally believed!
Alloying golden ring Alloying jewelry sets Alloying jewelry sets with oil palting
Thank you for the informatione