You can create separate sidebar templates for different pages of your site by using a simple include statement. When you write an include statement, you're simply telling WordPress that you want it to include a specific file on a specific page.
The code that pulls the usual Sidebar template (sidebar.php) into all the other templates, such as the Main Index template (index.php), looks like this:
<?php get_sidebar(); ?>
What if you create a page and want to use a sidebar that has different information from what you have in the Sidebar template (sidebar.php)? Follow these steps:
See Book VI for information on template tags and themes.
In Notepad, choose FileSave. When you're asked to name the file, type sidebar2.php, and then click Save.
The template is now in your list of theme files on the Edit Themes page (log in to your WordPress Dashboard and click Editor in the Appearance drop-down list).
<?php get_sidebar(); /> with the code <?php get_template_part(‘sidebar2’); ?> (which calls in a template you've ...