How To Remove Sidebar From WordPress Page, Homepage or From Posts
This post is all about how to remove sidebar from WordPress homepage or from posts.After reading this tutorial you can also remove the sidebar from the certain page.
The sidebar is the helpful element any website can have, it contains important information, ads, and other things.It can use differently to place the search bar, subscribe button, related posts etc.Do you want to remove the sidebar from your WordPress site?It is a widget area and bloggers love to customize it according to their need.
And it is a strange thing that it is a usefull element for blogger still we need to remove the sidebar from the website in some situations.Sometimes due to lack of the space for the main content for a specific page or posts, we have to remove the sidebar from the certain page or bunch of pages.
The other reason to remove sidebar is the screen size of mobile devices or other handy devices like tabs.Sometimes websites appear differently when a user is viewing your site from a mobile device and to improve the user experience you might have to remove the sidebar.
How To Remove Sidebar From WordPress
In this article, you’ll learn how to how to remove sidebar from WordPress.Not only from WordPress pages, you can also remove the sidebar from the all the pages, posts.
Remove Sidebar From WordPress Pages
Do you wish to remove sidebar from every page of your WordPress website? In order to do this, you’ll have to edit WordPress theme files.You can do this by just making some changes in settings, but this method only applies to some themes which allow you to use a full-width template.
You can remove the sidebar from certain page easily by just making changes in the attribute of the page.
All you have to do is open your website’s WordPress dashboard then open the page from which you want to remove the sidebar and select the “Full Width” option from the “Page Attribute” element.
As I mentioned that not all the WordPress themes have the full-width template option and in that case, you have to make some changes in the codes of your page.php file.
In your WordPress Editor, go to Appearance /Editor and click on page.php. Scroll down to the bottom where you will see the line of code that displays your sidebar.
Replace that one line with this
Once it done save the file and all in done.Your settings are saved and now you can check whether the side is completely removed or not.
Remove Sidebar From WordPress Posts
WordPress allows you to use a static front page and a separate page for your blog posts. Usually, most WordPress themes display sidebars on the blog posts page.So now you may be looking to remove sidebar from the WordPress posts to write the content in the wide content area.
If you don’t want to display sidebars on the blog posts page, then you need to go to Settings » Reading page. Notice the name of the page you are using as your blog posts page.
Now go to Pages » All Pages and edit the page used to display your blog posts. Under the page attribute section select a full-width template and then save your changes.
The other method of doing this is manually creating a full-width page template in WordPress.Not every website comes with the custom post template and in that case manually creating custom full-width page will help to solve this issue.
Creating the custom post template isn’t easy and need to have a knowledge of coding in PHP, but You’d need to follow the steps outline guide on how to create custom single post templates in WordPress.This article will help you to create and customize the single post template so you can remove the sidebar from the single post section.
How To Remove Sidebar From Everywhere In WordPress
If all these methods are useless for you then you probably looking to lower your effort and want to remove the sidebar from everywhere in the WordPress.In the third method of this tutorial, you’ll be able to remove the side from the entire WordPress website at once.
In order, you remove sidebar from every page and post of your WordPress website you’ll have to edit WordPress theme files.This is the only way of doing this, but it won’t be easy if you’re not friendly with the coding.
Now to begin the making changes in 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.
In a typical WordPress theme you may need to edit index.php, page.php, single.php, archive.php, home.php and so on.
Open a template file to edit it and then locate the line that looks like this:
If your theme comes with multiple sidebars, then you will see different instances of this code with a sidebar name inside the function. For example:
Delete the line that represents the sidebar that you don’t want to display.
Now, save and upload the file back to your website. Repeat the process for all template files responsible for displaying different pages on your website.
Once finished, you can go to your website and see it in action.You can see the same template with the same width but without the sidebar, it is because your theme has defined the width of the content area. Now that the sidebar is gone, you need to adjust the width of the content area by adding custom CSS to your theme.