A Complete Guide on How to Add, Remove and Customize Sidebars in WordPress

What is WordPress Sidebar

A WordPress Sidebar is an area of a website layout that is usually located on the left or right side of a page, but can also be located at the top or bottom of a page. The main function of a sidebar is to display additional content, provide navigation, and enhance the user experience. They usually contain various widgets (gadgets) such as search boxes, recent posts, classifieds, tag clouds, social media links, advertisements, calendars, and custom HTML code.

Image [1] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Worldwide, Fast Response

Examples of website sidebars

1.Wikipedia (online encyclopedia)

Image [2] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - Photonwave.com | Professional WordPress Repair Service, Worldwide, Fast Response

2. ElementorHelp Center

Image [3] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - Photonwave.com | Professional WordPress Repair Service, Worldwide, Fast Response

Sidebar Main Functions and Uses

  1. Navigation and search: Sidebars can contain a site's navigation menu and search box, helping users find the content they're interested in more easily.
  2. Latest Content Showcase: By displaying the latest posts, comments or popular articles, the sidebar can attract users to click and increase page views.
  3. Advertising and promotion: Sidebars are ideal for displaying advertisements or promotional content to effectively capture the user's attention.
  4. Social Media Links: By adding social media icons and links to the sidebar, a website can encourage users to share content on social platforms, thus increasing the exposure of the website.
  5. Customized content: Sidebars can add custom HTML code, text or other content to provide more personalization and functionality

Managing Sidebars from the WordPress Customizer

Image [4] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response

One of the main ways to manage theme sidebars is through the WordPress Customizer. If your theme supports sidebars and customization features, they will usually show up here.

The exact location of the settings depends on the theme, but you'll usually need to look for options such as Layout Settings, General Settings, or Site Wide Settings.

For example, when using an OceanWP theme, you can choose different sidebar configurations in the general settings, such as right sidebar, left sidebar, or both left and right sidebars, and you can also configure the width of the sidebar.

Image [5] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Worldwide, Fast Response

If you can't find these settings, try exploring the different areas in the WordPress customizer. Or, check the theme developer's support documentation.

Manage sidebars for individual content

Some themes also offer page-level settings that allow you to control the sidebars of individual posts or pages.

If the theme has this feature, you can see these options when using the WordPress editor. They may be displayed in the meta box below the editor, or in the document sidebar.

For example, when using the OceanWP theme, you can choose different sidebar layouts on individual pages or posts.

Image [6] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Worldwide, Fast Response

How to Add Widgets to WordPress Sidebar

The sidebar is an area on the website, but to which theAdd ContentIf you want to use WordPress widgets, you need to use WordPress widgets.

You can add widgets to the theme's sidebar in two ways:

  1. WordPress Customizer
  2. Specialized widget area

Both methods automatically synchronize, so using either one is fine. The advantage of using the WordPress customizer is that you can preview the effect of the widget in real time.

Manage Widgets via WordPress Customizer

To manage sidebar widgets through the WordPress Customizer, follow these steps:

  1. switch to Appearance → CustomizeThe
Image [7] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response
  1. option widgets Menu Options.
  2. You will be prompted to select which widget areas you want to manage. Depending on your theme, you may only see one option, or you may see multiple options, including non-sidebar areas (such as footers).
Image [8] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - Photon Fluctuations.com | Professional WordPress Repair Service, Global Reach, Fast Response
  1. Then, click"Add Widget"button to start adding the widget to the sidebar. After adding the widget, configure it using the options in the sidebar:
Image [9] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response

When adding new widgets, you will immediately see them appear in the live preview of the site. Drag and drop can also be used to reorder existing widgets.

In addition to using the customizer, WordPress provides a dedicated area for managing widgets. You can access it simply through the "Widgets" option under the "Appearance" menu.

In this area, you can see all the widgets that can be added to your website, as well as the sidebar area that comes with your theme (and possibly other widget areas, such as the footer).

To add a widget to your website, you simply drag and drop it from the list of available widgets to the sidebar or other area where you wish to place it. After that, you can further customize it by clicking on the widget's settings button, such as adjusting the text, selecting an image, etc:

Image [10] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - Photon Fluctuations.com | Professional WordPress Repair Service, Global Reach, Fast Response

Designing Custom Widgets with Elementor

Image [11] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response

With Elementor Pro, it's easy to design custom widgets and add them to your sidebar. Here's how to use Elementor s intuitive interface to create and add custom widgets in a step-by-step manner:

First, open the WordPress backend and navigate to the "Templates" section of Elementor and select "Add new item" to create a new section template. This template can be anything you want to showcase, such as an email subscription form or an engaging call-to-action phrase (CTA).

When creating a template, use Elementor's drag-and-drop interface to easily add and lay out various elements such as text, images, buttons, and more. Make sure to click the Publish button to save your template to the library when you're done.

Next, go to the sidebar area where you want to display this custom widget. Find and add the "Elementor Library"Widget. Once added, see a drop-down list of templates to choose from. From this list, select the specific template you just created.

Image [12] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - Photonwave.com | Professional WordPress Repair Service, Worldwide, Fast Response

How to Add a Custom Sidebar in WordPress

To add a custom sidebar to your WordPress website, but your theme doesn't have built-in sidebar support or you want to add more sidebars, you can follow these simple steps:

Step 1: Sign up for customized sidebars

First, register the sidebar with WordPress so that it appears in the "exterior condition" → "widgets" page. The code can be added in the following two ways:

  1. Edit the theme's functions.php file(Note that it may not be safe to edit the theme file directly, so it is best to use a child theme):
    • Create a child theme (if it doesn't already exist).
    • Add the code to register the sidebar in the functions.php file of the child theme.
  2. Using the code snippet plugin(e.g. Code Snippets, Insert Headers and Footers plug-ins):
    • Install and activate the Code Snippets plugin.
    • Create a new code snippet and add the code to register the sidebar.

Sample code for registering a sidebar::

function my_custom_sidebars() {
    register_sidebar(array(
        'name' => 'custom-sidebar 1', 'id' => 'custom-sidebar-1',
        'id' => 'custom-sidebar-1',
        
        'before_widget' =&gt; '<div id="%1$s" class="widget %2$s">',
        'after_widget' =&gt; '</div>',
        'before_title' =&gt; '<h2 class="widgettitle">',
        'after_title' =&gt; '</h2>',
    ));

    // If you need more sidebars, copy the code above and change the 'name', 'id' and other parameters
}
add_action( 'widgets_init', 'my_custom_sidbars' );

Step 2: Show sidebar on the front end

Sidebars are registered and need to be in the front-end template file (e.g. header.php,sidebar.php,footer.php or single-page template files) to call it in order to display a sidebar on the site. This usually involves using the dynamic_sidebar() functions and appropriate conditional judgments.

For example, in the sidebar.php file:

<?php if ( is_active_sidebar( 'custom-sidebar-1' ) ) : ? <?php if ( is_active_sidebar( 'custom-sidebar-1' ) ) : ?
    

This code checks if the sidebar named 'custom-sidebar-1' contains active widgets and displays the sidebar if it does.

After following these steps, you can see the new sidebar on the Appearance → Widgets page and add widgets to it.

How to create a sidebar with Elementor

To display a custom sidebar using Elementor, create a new post or page template that contains the sidebar as well as the main content area.

First, go toTemplates → Theme Builder. Then, select where to add the sidebar first - the Single PostmaybeSingle Page::

Image [13] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Worldwide, Fast Response

You can choose one of the pre-made templates. Or build your design completely from scratch. The easiest option is to choose only one of the templates that already includes a sidebar:

Image [14] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response

Then, edit thea side-bar (in software)widget and use theSelect SidebarThe drop-down list selects the custom sidebar registered in the previous step.

Once this is done, you should see a live preview of all the widgets that have been added:

Image [15] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response

To complete the task and ensurepostTemplate. When you perform this action, you can use display conditions to control where the sidebar template is displayed. Display it on all content (to use the sidebar site-wide). Or use display rules to add the sidebar to only specific content.

If you are used to using HTML, CSS or PHP, you can add the sidebar in code. Otherwise, it is recommended that you use Elementor Methods.

To display a custom sidebar in WordPress via code, you need to edit the theme's template file directly. Since this is modifying the theme directly, it's important to use a child theme to prevent overwriting your changes when updating the theme.

For more information on creating and using child themes, you can refer to the Comprehensive Guide to WordPress Child Themes.

After you create a child theme, you will move the parent theme folder's single.php file is copied to the child theme folder. Then, edit the child theme in the single.php file and add the following code snippet to the location where you want the customized sidebar to be displayed:

<?php get_sidebar(); ?>

How to Remove Sidebar in WordPress

How to remove a sidebar you don't want to use. For example, your theme comes with a sidebar, but you want some or all of the content to use the full-width template.

To remove the sidebar in WordPress, you have two options:

  1. Using Elementor Pro
  2. Usage Code

Before using these methods, check if your theme has a built-in feature to disable the sidebar. Many themes provide options in the WordPress customizer to disable the sidebar without having to do it manually. Or, the theme may come with a full-width template that can be selected when using the WordPress editor.

If your theme doesn't have these options, follow these steps to manually remove the sidebar.

Removing Sidebars with Elementor

To remove the WordPress sidebar using Elementor, you need to create a template that does not contain the sidebar area. The steps are as follows:

  1. Creating Templates: Go to "templates" → "Theme GenerationAppliance", select the location where you want to remove the sidebar, such as a single post or a single page.
  2. global application: If you wish to remove the sidebar throughout your site, you can use this template to cover everything.
  3. local application: If you only want to remove the sidebar on certain pages, you can choose a template without sidebar where you need it.
Image [16] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response

When finished, you canposttemplate and use display conditions to control where it is displayed.

Remove WordPress Sidebar with Code

You can remove the WordPress sidebar by editing the theme's template file directly. The steps are as follows:

  1. Using child themes: Make sure to use a child theme due to the need to edit the theme files. This will prevent updating the theme from overwriting your changes.
  2. Copying template files: The template file that will need to be removed from the sidebar (e.g. single.php,archive.php etc.) from the parent theme to the child theme folder.
  3. Editing template files: Open these files and delete all similar <?php get_sidebar(); ?> snippet (the code may be slightly different, but it basically calls the sidebar).
  4. Adjusting HTML and CSS: Adjust HTML and CSS code as needed to ensure proper page layout.
Image [17] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response

How to show different sidebars on different content

Previously we discussed how to add a sidebar in WordPress even if your theme doesn't support it. But what if you want to display different sidebars on different content? This allows you to display different collections of widgets for different types of content.

For example, you may want to use one set of widgets for blog posts in the "Reviews" category and another set of widgets for blog posts in the "Tutorials" category.

utilization Elementor Show different sidebars

This is the easiest way and you can follow the steps below:

  1. Creating Templates: First, create multiple Elementor templates, each containing its own sidebar.
  2. Setting conditions: Then, go to Condition Settings to assign each template to a relevant category, page, or other condition.

Using the Content-Aware Sidebar Plugin

Another way is to use the free Content-Aware Sidebar plugin. After installing and activating the plugin, follow these steps:

  1. Add new sidebar: Go to "Content Aware → Add New".
  2. Setting conditions: Select the condition you want to replace the default sidebar with. For example, if you want to use this sidebar for all blog posts in the "Comments" category, create a category condition.
Image [18] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - Photon Fluctuations.com | Professional WordPress Repair Service, Global Reach, Fast Response
  1. switch to"Operation"tab and select the sidebar you want to replace. Alternatively, you can "merge" the sidebars to include the contents of both:
Image [19] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - photonwave.com | Professional WordPress Repair Service, Global Reach, Fast Response
  1. After making your selection, click"Create". Then, go toAppearance → Widgetsto add content to the conditional sidebar:
Image [20] - Complete Guide on How to Add, Remove and Customize Sidebars in WordPress - Photon Fluctuations.com | Professional WordPress Repair Service, Global Reach, Fast Response

Summary:

Using Elementor or code, you can set up different collections of widgets for different content types, as well as use the Content-Aware Sidebar plugin for more advanced customization. Whether it's through the WordPress Customizer or manually editing a template file, this guide provides comprehensive steps and methods for a variety of user needs.


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
Customer Service
Customer Service
Tel: 020-2206-9892
QQ咨詢:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
? Reprint statement
Author: xiesong
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments