January 18, 2019
January 18, 2019
WordPress Sidebar is a slot for widgets on the left, right or bottom of your theme. Although it is very useful, sometimes you will need to remove sidebar in WordPress because you want to have a widget-free page/post. Most modern themes have specific options on their settings panel to remove the sidebar. However, if you don’t have access to one, this tutorial is perfect for you. We will give you 3 actionable tips on how to remove sidebar from any WordPress page/post.
The first method will remove the sidebar from your theme altogether. In order to do this, you need to edit your theme files. We recommend you to make a backup of your WordPress site and use the child theme, otherwise, you will lose all the changes you made. This is because a child theme inherits all the functionality, features, and code from the parent theme without affecting the parent theme itself. Therefore, any changes made in your child theme will not overwrite the original. Also, you will not lose any modifications after theme update.
Once you have set up your child theme, you need to access your theme files. You can either use the help of FTP clients like FileZilla, open it using Hostinger files manager, or go to the WordPress dashboard > Appearance > Editor. In this tutorial, we will use the first option.
Please also be aware that your theme consists of many templates. Therefore, you will need to copy all templates you want to edit from parent to your child theme and then edit every template with the sidebar in it. For example, you may edit home.php, index.php, single.php, archive.php, page.php and so on.
To find the template files, go to /wp-content/themes/your-theme folder. Pick one template you’d like to edit and copy them to your child theme folder. Then open template file and find this specific code:
<?php get_sidebar(); ?>
Since the code’s function is to call up the sidebar, you have to erase the code to remove your sidebar.
In addition, there is a possibility that your themes have multiple sidebars. In this case, you need to find codes that have “sidebar” name in them. The code snippet below calls footer widget:
<?php get_sidebar('footer-widget-area'); ?>
Deleting these types of codes will remove multiple sidebars in your template.
After all the steps are done and saved, go to your website. You will find that the sidebars are already removed. However, you still don’t have the full-width images and texts. You can see that the previous sidebar spot is replaced by a blank area. It happens because your theme has a default setting for the content area width. You can simply add custom CSS to fix up the width.
Your website is made of multiple pages and posts. Sometimes you may only need to remove the sidebar on a specific page and post without affecting other pages. The process is pretty similar to removing the sidebar completely from anywhere in your website. The difference is, you need to create a new template by copying the existing one. To make it clearer, let’s take a closer look.
Some modern WordPress themes have provided the default full-width template for a static page. Therefore, removing the sidebar from a static page is fairly easy. You only need to go to the Page Attributes meta box and choose Full Width in Template selection.
If this option doesn’t appear, it means that the full-width page template is not provided by your theme. Therefore, you will need to create a new full width template file. In order to do so, take the steps below:
/* Template Name: Full Width Template */
If a static page often comes with a full-width template by default, most WordPress themes always put a sidebar on a blog page. In order to remove the sidebar only from blog pages, follow these steps below:
Sometimes, you may only need to remove the sidebar on one specific post. If your theme has provided you with the full-width post template, you don’t have to deal with coding. You just need to make a new post and go to Post Attributes meta box. Choose the Full-Width template to remove the sidebar. But, if you can’t find it, you have to make a custom page template by yourself. The steps are quite similar to creating a custom page template for a static page. The only difference is that you will need to copy and edit contents of single.php template file.
If you don’t want to deal with code, you can also manage your sidebar using a plugin. We recommend using this helpful plugin: Fullwidth Templates for Any Theme & Page Builder.
Just like the name suggests, this plugin works for any theme and page builder you might use for your website. Moreover, using it is extremely easy. You only need 3 clicks to create a fullwidth template.
Once you install and activate the plugin, you will have access to these 3 basic settings.
The first setting will remove everything from your page: header, footer, sidebar, comments. All you have left is a blank page which gives you a full control over your layout. This layout is suitable for creating a landing page.
The second setting will eliminate sidebar, page title, and comments from the layout. Fortunately, there is no empty area left. Your content area will be automatically stretched into full width to fill the layout. The second setting is ideal if you are using a page builder.
The third setting will only remove the sidebar from your layout. You can choose this if your theme doesn’t offer the No Sidebar option. The other elements and layout styling will not be affected.
Although a sidebar is helpful for placing widgets, sometimes you need to remove it from your template to get a better website appearance. We have provided you with 3 actionable guides, kindly choose the most appropriate one(s) for your needs. Do you have any additional method to remove the WordPress sidebar? Don’t hesitate to share your experience with us!