Skip to main content
Wordpress

• ▷ How to remove WordPress sidebar or sidebar on specific pages or posts

Contents




Looking for a way to remove the sidebar or the sidebar of your WordPress site? Most themes come with a sidebar of some kind, but es posible que no desees usarla en todo tu contents.

While a sidebar surely gives you more space to put "stuff", having more "stuff" is not always a good thing, and removing the sidebar gives your site a clean, distraction-free look.

At the same time you may want to remove it for other reasons, and this is why we want to help you remove the sidebar from your WordPress site.

In this article we will explain how to do some things like:

  • Remove WordPress sidebar at specific pages, con un simple plugin o con tu propio código.
  • Remove WordPress sidebar at your whole site, with your own code.
  • Show a different sidebar in each type of content different with a plugin (this is a kind of bonus, since technically you will not be removing the sidebar).

These contents are all advantages Let's do it at once!

A quick and easy way to hide the sidebar - Check this out first

After this quick section we are going to cover the ways to actually remove the sidebar or WordPress sidebar.

Regardless, we started with this little solution because it is super simple, and it may get you where you need to be without any extra effort.

Basically, instead of removing the sidebar, you can remove all the widgets from the sidebar by going to Appearance → Widgets and removing them:

Now, it's not perfect because the sidebar could take up "space", but hide any content from the sidebar. If that's all you're looking for, this approach is a great place to start.

Is not sufficient? Do you really intend to remove the sidebar in WordPress or just remove the sidebar for certain content? continue reading!

How to remove the sidebar in specific parts of content

If you wish hide the sidebar or page by page sidebar, there are a few different methods you can use.

First, you can do it with a plugin, which is what we recommend for most people because it is cost-free and simple, but at the same time you can do it with your own code.

Check if your theme offers full-width templates

Before looking for a third-party solution, many themes allow you remove the sidebar or sidebar after each post with built-in functions.

Thus, check that before doing anything else. As an example, GeneratePress allows you to deactivate the sidebar for any content just by checking a box.

Many other topics are already designed to be combined with page builders or page builders that offer equivalent functionality.

Use a free plugin to remove the sidebar on certain content

The easiest way to remove the sidebar or sidebar of your site to page by page is with the free plugin Fullwidth Templates for Any Theme & Page Builder from Brainstorm Force, the creators of the popular Astra theme.

This plugin basically add a full width template to any theme. You don't have to configure anything, you just have to install and activate the plugin.

You can then use the dropdown menu Publish attributes or Page attributes and select FW No Sidebar, to create full-width content without a sidebar.

This plugin at the same time includes other templates that make it possible to hide the header and other widgets

And that's all there is to it. Super simple! truth?

Code your own full-width template

If you don't like using plugins for some reason at the same time you can manually create your own full width template to remove the sidebars or sidebar of the pages.

For most users, we would really recommend sticking with the plugin above, thus keeping this tutorial at a fairly high level:

  • Connect to your WordPress site via FTP
  • Navigate to … / Wp-content / themes / name-of-your-theme
  • Edit the file page.php
  • Create a new file on your desktop called full-width.php
  • Copy the content of page.php to the new file full-width.php
  • Add the following code snippet after the label <?php
/ * Template name: Full width template * //
  • Find and remove this code snippet from the file full-width.php

  • Upload the full-width.php file to the child theme folder via FTP

You can then use the full width template via the drop down menu Page attributes, just as you saw it with the plugin.

At the same time you can do something equivalent to create a full-width template for posts.

Keep in mind that sometimes things get a bit more complicated due to your theme labeling get_sidebar () in a different file (usually in the "template-parts" folder). If that's the case, we really recommend going with the plugin since it is much simpler.

How to remove the WordPress sidebar for the whole site

Let's say you really hate the sidebar or sidebar of your WordPress site. Not only do you want to disable it on specific pages, but you want to get rid of it in all your content.

In that case, basically you will do what we have shown you in the manual code method, but for the default template. In other words, instead of creating a separate template that applies page by page, this will apply to all pages.

With this method, this will require a bit of code knowledge.

To get started:

  • Connect to your WordPress site at via FTP
  • Navigate to … / Wp-content / themes / name-of-your-theme
  • Edit single.php

Next, you need to find and remove this code :

Then repeat the process for other files that may include a sidebar. The common files would be index.php, page.php, etc.

Step 2: Correct CSS to create full-width content

After the previous step, the sidebar should be gone. Regardless, the content will act as if there is a sidebar when it comes to layout, which can lead to some awkward situations.

In order to solve it, necesitarás usar algún CSS personalizado. Unfortunately, we cannot give you the exact code due to it is different for each topic.

Basically querrás que el ancho del área de contenido principal be del 100%. As an example, this is what happens with the default Twenty Seventeen theme.

And here is the exact code that we have used:

.has-sidebar: not (.error404) # primary {width: 100%; }

If you have a hard time figuring out which CSS to use on your site, you might want to try a paid service like WP Kraken.

How to display different WordPress sidebars for different content

Por último, tal vez en lugar de quitar la barra lateral, sólo quieras mostrar bars laterales diferentes para contenido diferente.

As an example, you might want a large, ad-packed sidebar for some content, and then a minimalist sidebar for others.

That is absolutely possible. In fact, we wrote an entire post on the subject. If you want to know more, check out how to use different WordPress sidebars for different types of content.

At the same time you can use this to display a blank sidebar (without widgets) for certain content, which at the same time can take you to the same place as these other methods.

Final thoughts

If you want the easiest way to remove the sidebar or sidebar of your WordPress site, you can try remove all widgets. 

At the same time you can use the free plugin Fullwidth Templates for Any Theme & Page Builder, to create full-width templates on any topic, getting a template that you can use after each post or page by page.

If you just want to remove the site-wide sidebar or just prefer a more manual approach, you can at the same time remove any mention of from your theme files or create a custom template without this snippet, though you may need to add some custom css to clean things up later.

We hope you enjoyed this post and find the necessary tools to remove the sidebar o barra lateral de tu sitio Web en WordPress siempre que así lo desees.