How to Remove the Sidebar in WordPress

A sidebar is a default component of any WordPress site. It is visible on the right or left side or underneath the content space on each of your web pages. It can be a valuable addition on any website page. Beginning with displaying the history of the founders to sharing affiliate offers, the sidebars give data about site navigation, contact information, advertisements and other site related content. However, it is not always important to keep a sidebar on your site.

Would you like to expel the sidebar from your WordPress site? In this article, we will demonstrate best practices to delete or hide the sidebar from your WordPress site.

When and why you should remove sidebar from your WordPress site?

Almost every free and paid WordPress theme accompany different sidebars or widget spaces. The motivation behind placing sidebars on your WordPress site is to showcase things that are not same as your post or page content. These items are various sections of your site such as email signup forms, advertisements, social networking profiles and so on. These things can be effectively added to the sidebar with the help of a sidebar compatible WordPress theme.

In many WordPress themes, these sidebars show up distinctively when a user visits your site via smartphone or tablet. Due to the reduced width of the device screen, sidebars that show up on the right or left on user desktop are automatically moved to the base on mobile or tablet screens.

There is no doubt that sidebars are highly useful and can help you to develop your business. However, some site owners think that removing sidebar from their website enhances user quality, quantity and experience.

From where do you want to remove the sidebar?

The sidebars are present with various customizable settings.  It could be on a particular page layout, static pages or on the whole website. WordPress utilises unique layouts for these diverse page types, it is entirely up to you, what you want to keep and what you want to delete.

Removing Sidebar from the Whole WordPress Site

Once you have chosen where you need to erase the sidebar from, firstly connect to your site with the help of an FTP client and then open the sidebar template from your WordPress theme folder.

To open the folder, follow this path: /wp-content/themes/your-current-theme/. Here, you will see the template files. These files have a line of code that is used by core WordPress to add a sidebar to any particular post or page. This line of code is visible around the base. To remove any sidebar, remove this line of code. This code looks like:

<!--?php get_sidebar(); ?-->

If you have a WordPress theme that integrates multiple sidebars, then you may come across various instances of similar code. This will include a sidebar name within the function like:

<?php get_sidebar('footer-widget-area'); ?>

You just need to delete the line of code for the sidebar that you do not require or do not want to show on your site.

Once you are done with removing the line of code, click Save and check the changes on the website in real-time. Deactivate any caching plugins beforehand. Caching plugins won’t allow the changes to reflect in real-time. Once the changes are done and you’re satisfied with the results, you can activate the cache plugin.

Next, remember that deleting sidebars doesn’t make any change in the content areas. This may leave some space around your content. This is due to the defined width of the content area in your WordPress theme.

As the sidebars are no more visible on your site, you will have to adjust your WordPress theme’s content area width and height by adding custom CSS.

Figure out your theme’s CSS class that defines content area width. You can use the inspect tool of your browser to do the same. The CSS class for content area width will look somewhat similar to this:

.content-area {
    width: 100%;
    margin: 0px;
    border: 0px;
    padding: 0px;
}

 .content-area .site {
margin:0px;
}

Removing Sidebar from Static Page

Some WordPress themes are ready-to use on full-width templates. You can use these templates on any static page on your WordPress site. If you do not require any sidebars, you can just remove them with the following method:

Remember, you are not removing sidebars for the entire site; hence, just edit the page you want to delete the sidebar from. Once you are done with removing sidebar under the static page, go to the Page Attributes >> Templates >> Full Width.

However, some themes do not come with a “Full Width” page template. In this case, you will not see the above mentioned  full-width option in the page attributes section.

Here you will have to create your own full-width page template. Open any text editor (Notepad is a favorite) and copy-paste the below-mentioned code. Be sure to start with a blank file:

<?php
/*
*
Template Name: Full-Width
*/
get_header(); ?>

 Save the file as “full-width.php” on your desktop or laptop. Follow these steps:

  1. Go to the WordPress site via FTP client.
  2. Go to /wp-content/themes/your-content-theme/folder >
  3. Open page.php file.
  4. Copy all the code after <?php get_header(); ?>.

After you copy the code on “page.php” file, paste it to the “full-width.php” file that you saved on your computer. Now, find and delete the line of code that looks like this:

<?php get_sidebar(); ?>

Save the changes and upload your “full-width.php” file to the current WordPress theme folder. This way you can edit any page on your site and select the full-width page template option.

Remove Sidebar from Blog Post Page

Whether you have a static front page or a dynamic one, WordPress allows you to create separate pages as your blog posts. Many WordPress themes display sidebars even on the blog posts page.

Removing sidebars from the blog posts page is quite simple. Go to the Settings >> Reading. Select the Posts Page section as Blog. Go to Pages >> All Pages >> Go to “Page Attribute” section and select Full Width under the Template tab and click Save.

If there is no full-width option in your theme, read the previous section in the article and follow the instructions to create a full-width template in your current theme manually.

If you do not want to remove sidebars from all posts, you can create custom single post templates and delete sidebar from some individual posts.

Conclusion

There could be some more features and elements that you need to edit, depending on the WordPress theme. Your content includes many other elements like paragraphs, h1, h2 and so on. Some of these elements have their own declared widths that you may need to adjust.

Check your site pages thoroughly to identify any such element and make the necessary changes to get a full-width view.

How to Remove the Sidebar in WordPress
Rate this post

Know Everything About WordPress
Best Products in Your Inbox

Subscribe to our mailing list and we will surprise you with amazing WordPress freebies

Jupitar Theme

Know Everything About WordPress
Best Products in Your Inbox

Subscribe to our mailing list and we will surprise you with amazing WordPress freebies