The Twenty Ten default theme comes with Primary and Secondary right sidebars, but they are stacked one above the other, you might be wondering why.
At a guess I would say it gives someone new to WordPress the ability to add widgets to the secondary sidebar without losing the built in widgets on the primary sidebar, we are going to use the secondary sidebar for a template page.
Over on the WordPress Forums a question was asked about having pages with a different sidebar in the default twenty ten theme.
There are a number of ways to do this editing the default theme or using a child theme, we have done this using a child theme, editing just one existing file and adding two new files, we did this without touching the style.css or the functions.php.
How We Did It
We created a new child theme folder, added a new style.css file for the child theme, and copied the screenshot.php from the twenty ten themes folder to our child themes folder.
We took the sidebar.php file and copied this to the child theme, opened the file and removed the code for the secondary sidebar, created a new file sidebar-2.php and added the secondary sidebar code to this file.
Taking the page.php file from the parent and copying this to the child theme, renamed the file and added the template code in the file, we replaced the get_sidebar() with get_template_part(‘sidebar’,2)
That was all it needed, now we have a template page with the secondary sidebar, we are not going to get into the code as this is just a reply to a forum question.
The Download2010 Alternate Sidebar (1386)
We have zipped up the files into a child theme file, this can be used as is or you can take out any parts you want, to add this to a copy of the default twenty ten, we know that some will prefer this method, open the zip, replace sidebar.php, add sidebar-2.php and page-secondary.php
Add some widgets to the Admin > Appearance > Widgets > ‘Secondary Widget Area’, then Pages > Pages select a page and Quick Edit or Edit and apply the ‘Secondary Sidebar’ template.
We do require your feedback to improve our themes and tutorials, please leave your comments good or bad.
Code disclaimer information
If this document contains programming examples, www.DigitalRaindrops.net grants you a nonexclusive copyright license to use all programming code from which you can generate similar functions tailored to your own specific needs.
All sample code is provided by http://DigitalRaindrops.net for learning illustrative purposes only.
These examples have not been thoroughly tested under all conditions. www.DigitalRaindrops.net, therefore, cannot guarantee or imply reliability, serviceability, or function of these examples.
All programs contained herein are provided to you “AS IS” without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.
Registration and Membership is no longer required for downloading files or interacting with Digital Raindrops, posting a comment or topic in the forum does use Captcha to reduce spammers.
This website is a tool to support and promote WordPress and Artisteer theme development, please support, share and give credit for any benefits you gain from the tutorials on this website.