WordPress

Remove the WordPress Sidebar


Are you interested in removing the sidebar from WordPress? If so, read on. Your sidebar is part of your WordPress theme and designed for things like widgets. It can feature on the left or right of or below your content, and whilst some find it helpful and useful, others find themselves seeking ways to remove it. The vast majority of WP themes have various sidebars and widget-ready areas. They are used to show items that aren’t supposed to be part of your content or posts. They might include links to parts of your site or social media profile for instance.

A sidebar will look different if a user is viewing your site on a mobile device and is usually moved to the bottom of the screen because of the different screen shape involved.

You may wish to remove your sidebar because you feel it is compromising the user experience. You need to edit WordPress theme files to get rid of sidebars. You can begin by connecting to your WP site via an FTP client. After this, you need to head to /wp-content/themes/your-current-theme/ folder. Themes are made from a series of different templates. This means you will have to edit all templates in which sidebars are displayed. These can include page.php, index.php, home.php and others.

Open each template file so you can edit it and look for lines that look like this

1

<?php get_sidebar(); ?>

Should your theme have various sidebars, there will be different versions of the code with sidebar names inside their functions. One examples would be:

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

You need to remove the line representing the sidebar you wish to remove. Save and upload the file back to your site. You need to repeat this process for all template files that display different pages on your site. View your website to see the changes after. You may see that your content has the same width but the sidebar is empty. You can change this by adjusting the width of the content area. Add custom CSS to your theme to make the changes. You must work out the CSS class your theme uses so the width of the content area can be defined. Do this with the Inspect tool in your browser.

If you wish to only remove sidebars on some pages but not all of them, this is perfectly possible.

Many websites have sidebars on some areas like home pages but not others.

Do you need to remove sidebars from static pages?

A number of WordPress themes have full width page templates that are ready to use. You can use them with any static WP page and they don’t show sidebars at the side of content. If you do wish to remove a sidebar from a static poage, edit the page and choose the full width template from the ‘Page Attributes’ box. Should you not see an option for selecting a template, this will mean the theme does not have a full-width page template. This means you must manually create a full-width page template. Use a plain text editor such as Notepad and open up a new blank file so you can past this code into it.

1

<?php

2

/*

3

*

4

Template Name: Full-Width

5

*/

6

get_header(); ?>

Save the file as a full-width.php on your desktop.

Use an FTP Client to connect to your site. Go to the /wp-content/themes/your-current-theme/ folder. Edit the page.php file and copy all the data after the after <?php get_header(); ?> line. Paste the code into your full-width.php file and remove the line that resembles this:

 

1

<?php get_sidebar(); ?>

Don’t forget to save your changes. You then need to upload the full-width.php file to your current theme folder.

You will then be able to edit any page on your site and select your full width page template.

Do you need to remove sidebar from the blog posts page in WordPress?

In WordPress, you can use a static front page and a separate one for blog posts. The vast majority of WP themes will show sidebars on the blog posts page. Should you not wish to show sidebars on the blog posts page, go to Settings » Reading. Head to Pages » All Pages. Edit the pages you are using to display blog posts. Choose a full width template from the page attribute section and remember to save your changes.

If there is no full width template option, you must create a full width template manually. Follow the instructions further up this page for instructions.

How to remove a sidebar from a single WP post

You can create a custom single post template to delete a sidebar from a single WordPress post. WordPress 4.7 has support for post templates. In the custom single post template, remove the sidebar part of the code to get the results that you require.

Why should I remove sidebars anyway?

There are many reasons for removing sidebars in WordPress. Many people remove sidebars to streamline the user experience and make their sites less cluttered so they can focus on content, especially when they are working hard to promote offers and other news (we use sidebars a lot on Top 10 Website Hosting). The more your readers focus on your content rather than what’s going on around it, the easier it is to keep the search engines happy and convince them that you are providing something valuable. Sidebars can be very useful, but they can also be incredibly distracting in certain scenarios.

Why choose WordPress?

WordPress is the world’s most popular content publishing platform, and one of the reasons it is looked upon so fondly is the fact that very little programming knowledge is needed to start deriving value for it. It enables you to publish fresh content on a regular basis without having to rely on computing experts, and the vast array of themes available to you make it easy to customise your site and tailor it towards your exact needs and requirements as well as the expectations of your visitors.


View Comments
There are currently no comments.