Showing different sidebar on different pages

February 21, 2007 – 9:06 pm | by

To show a different sidebar on different pages, replace the standard call for the sidebar:

<?php get_sidebar(); ?>

with the following code:

<?php include ('sidebar2.php'); ?>

The same can be done to call different headers, i.e. instead of <?php get_header(); ?> use <?php include ('header2.php'); ?>For more information, see Different Sidebars Anyone? on the WordPress codex.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
  1. 4 Responses to “Showing different sidebar on different pages”

  2. By Tony on Apr 22, 2007 | Reply

    But wait, which page do I add/change this code on?!

  3. By joanne on May 10, 2009 | Reply

    thanks for this tips! was really useful as i was configuring a website for my client :)

  4. By junthit on Jul 5, 2009 | Reply

    What next? confuse……….

  5. By Ufuk Erdogmus on Mar 9, 2010 | Reply

    For the ones who are confused:
    1. You create a new page template (check google)
    2. In your new page template php, you do these changes mentioned here.
    3. Select your new template on the pages you want to have your new sidebar :)
    I think that should answer you :)

Post a Comment

Studio Press Premium Themes