How to Remove the Sidebar in WordPress

The sidebar is a helpful element for your website. It is a widget ready area that appears on left, right or below the content area on every page. Its use is usually to display items that are not part of the post or page content. It can be used to give links to different pages of your website, email list signup forms, advertisements, social media profiles, etc.
So why would you want to remove the sidebar?
Sometimes, due to the screen size of mobile devices, the sidebar may appear differently. The sidebar might move at the bottom of the screen. So, to improve the user experience you might have to remove the sidebar.
In this article, we’ll show you how to remove the sidebar in WordPress.
How to remove sidebars from everywhere in WordPress?
Do you wish to remove sidebar from every page and post of your WordPress website? In order to do this, you’ll have to edit WordPress theme files.
Connect to your WordPress website using an FTP client such as Filezilla. After doing so, go to /wp-content/themes/your-theme/ folder. WordPress theme files consist of templates, you need to edit all the templates which display the sidebar.
You’ll need to edit index.php, archive.php, page.php, single.php, home.php and so on as these display sidebar.
You should be looking into your template file for a line which looks something like this:
<?php get_sidebar(); ?>
If multiple sidebars are present in your theme, then you’ll see the sidebar name written in the above function, such as,
<<php get_sidebar('header_sidebar'); ?>
Delete the line that displays the sidebar, from the function.
After deleting the sidebar, save and upload the theme file back to your website. Repeat this process for all template files that are responsible for displaying different pages on your website.
How to remove sidebars from individual pages in WordPress?
What if you want to remove sidebars from individual pages in WordPress? And allow it to display on other sections of your website?
For some, it is preferred to show sidebars everywhere but static pages, or blog post page, or single blog page. Let’s see how to remove sidebars from different individual pages.
How to remove sidebars from a static page in WordPress?
Most of the WordPress themes come with ready to use, full-width templates. These templates can be used any of your static pages in WordPress and do not display sidebars on either side of the content.
All you have to do is edit the page from where you want to remove the sidebar and then select the full-width template under ‘Page Attributes’ meta box.
Some themes don’t have a full-width template, if your theme doesn’t have it, there won’t be ‘Full Width’ option in the template as shown above.
What do you do then?
Well, you’ll have to create a full-width template manually. To make a full-width template manually, open a plain text editor such as Notepad and paste the following code in the blank file:
<?php /* * Template Name: Full-Width */ get_header(); ?>
After pasting the code, save this file as full-width.php on your desktop. Once you’ve saved the file, connect to your website via an FTP client and got to/wp-content/themes/your-theme/ folder. Locate and Edit the file called page.php and copy everything that appears after <?php get_header(); ?>
line.
Now paste the above code in your full-width.php file. After that, you need to locate and delete the line that looks like this:
<?php get_sidebar(); ?>
After deleting the line, save the changes and upload the full-width.php file to your current theme folder.
Now you can see the full-width page template.
How to remove Sidebar from Blog Posts Page in WordPress?
Most of the WordPress themes display sidebars on the blog post page. Apart from a static front page, WordPress allows you to use a separate page for your blog posts.
What if you don’t want to display sidebar on your blog posts page?
To do so, you need to go to Settings » Reading page.
After that, go to Pages » All Pages and edit the page used to display your blog posts. Choose ‘Full Width’ under the page attribute section and save your changes. If you cannot see the ‘Full Width’ template then you’ll have to manually create one as shown in the above section.
We hope that this article on how to Remove the Sidebar in WordPress was helpful. If you know any other methods, please share with us in the comment section.
Leave a Reply