How to Create Different Sidebar and Footer Templates for Your Pages in WordPress Twenty Fifteen
You can create separate Sidebar templates for different pages of your WordPress site by using a simple include statement. When you write an include statement, you’re 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:
Create a new Sidebar template in a text editor, such as Notepad (Windows) or TextMate (Mac).
Save the file on your computer as sidebar-page.php.
Upload sidebar-page.php to your themes folder on your web server.
The new Sidebar template is listed in your theme files on the Edit Themes page. You can open this page by choosing Appearance → Editor on the Dashboard.
To include the sidebar-page.php template in one of your Page templates, open the desired template on the Edit Themes page (Appearance → Editor) and then find this code:
<?php get_sidebar(); />
Replace the preceding code with this include code:
<?php get_template_part(‘sidebar’, ‘page’); ?>
With the get_template_part(); function, you can include virtually any file in your WordPress templates. You can use this method to create Footer templates for pages on your site, for example. To do this, first create a new template with the filename footer-page.php and then locate the following code in your template:
<?php get_footer(); ?>
and replace the preceding code with this code:
<?php get_template_part(‘footer, ‘page’); ?>
You can do multiple things with WordPress to extend it beyond the blog. You can use WordPress to create a fully functional website with a CMS platform — anything from the smallest personal site to a large business site.