Remove Sidebar From Blogs

Do you want to remove the sidebar from your blog posts and blog category pages? Not only that, but you then want said posts & category pages to expand to fill the full available width? Have you spent hours stumbling over one wrong answer after another? Have no fear. I finally figured out how to do this, and I want to share it with the world.*

For: Twenty Twelve Theme, all Category and Single Blog Post pages (Though I am assuming this works for most WordPress themes.)

NOTE: All of these changes will go into your Child Theme. There are a ton of great, detailed, stepbystep guides on how to create a child theme, so I won’t go into that here.

Step 1: Make your own copy of the single.php and category.php files from your parent theme. You can either download them via an FTP program, or go to Appearance -> Editor and click on the link to your parent theme to view all of the files associated with that theme. Click on single.php and copy/paste all of that text into a text file, and save it as single.php on your own computer. Do the same for category.php.

Step 2: Open your local copy of single.php and category.php and make the following two changes in each file.

Step 2a: Change the line that says <section id=”primary” class=”site-content”>
to say <section id=”primary” class=”full-width”>

Step 2b: Delete the line that says <?php get_sidebar(); ?>

Step 3: Upload your local copy of single.php and category.php to the child theme directory on your site.

DONE! (See? Super easy.)

* I know you can remove widgets from the widget screen, but I WANT a widget in the sidebar, because that’s the only place that my random quote widget actually looks good. I want that sidebar to appear ONLY on my front page, so I am using the default template on my home page, and allowing it to display the sidebar. All other static pages use the “Full Width, No Sidebar” template. However, there is no such template available for blog pages. Super frustrating! But I have found the answer, and it’s so simple, I don’t know why it took me this long to find the right way to do this.