How to use different-different custom sidebars on few pages and default for rest (5 posts)

  1. Veril Thomas
    Posted 5 years ago #

    How to display different-different custom sidebars on few pages and default for the rest in WordPress, any version..

  2. Joni
    Posted 5 years ago #

    You'll have to create a separate page template for each custom sidebar you want running.

    Once you've done that, you need to create your custom sidebar templates. Name them something that allows you to remember what they contain.

    For example, let's create three different sidebars in addition to the default sidebar.php:


    In order to pull those in on the page we want them, we'll need to create three different pages. They don't have to be different other than the call to the specific sidebar, but they can if you need them to.

    Don't forget to put the custom page code at the top of each, like this:

    Template Name: Custom Page Name

    Then for each custom page template, find this code:
    <?php get_sidebar(); ?>

    And substitute this instead, using the name of the desired sidebar template you just created:

    <?php include (TEMPLATEPATH . '/custom-sidebar.php'); ?>

    That way, each custom page has its own custom sidebar. There may be an easier way to do this, but that's how I've done it on my site as well, with a custom sidebar for my contact info on my Contact Us page. :)


  3. marquex
    Posted 5 years ago #

    The easiest way of having different sidebars for each page is using the Custom Sidebars plugin:


    Don't have to know anything about coding for using it and it have a lot of options for personalize your site completely.

  4. greenmagnate
    Posted 5 years ago #

    @ Marquex
    Thanks. I have the plug-in installed, but can you guide me here, that how i am gonna connect a specific custom bar to specific page.

  5. marquex
    Posted 5 years ago #

    You have a couple howtos at the bottom of the page


    Basically you have to tell the plugin what are the sidebars of your theme you want to change for some pages and then in the page-edition, in the admin area you will see a new box to define what sidebar the page will have.

    There is also a mini how to about creating and widgetizing new sidebars.

    Not difficult, if you have problems just tell me.

Topic Closed

This topic has been closed to new replies.

About this Topic