Twenty Ten Alternate Sidebar

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 Download 

 2010 Alternate Sidebar (1235)

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

The Template

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.  

Notices

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.

Membership

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.

2 thoughts on “Twenty Ten Alternate Sidebar

  1. Problem: After moving the sidebar.php, sidebar-2.php and page-secondary.php files into my child theme folder, viewing the home page (not a static page) and all posts, the original sidebar with the sidebar widgets that I’ve already added to them is no longer there; I can view only the secondary sidebar.

    Meanwhile, in the backend, Appearance > widgets, the sidebar still shows all the widgets that were added to both the default primary and secondary widget areas before moving the files ‘sidebar.php’, ‘sidebar-2.php’ and ‘page-secondary.php’ into the theme folder. There is no sign of any alternative sidebar in the backend.

    I want to keep my home page as it is, with the default sidebar and its current widgets, but I want to be able to select an alternative sidebar for pages and posts. And somehow or other, this solution is not working as it should. Help?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Connections

Connect with Us
Follow Digital Raindrops on Twitter Join Digital Raindrops on Facebook
Share

Related Posts

Posted in Twenty Ten

asc3.png

It is strange that there is no option to reverse the display order of the posts on the category page, when we select a category the list is the same as a blog, in descending order newest to oldest. That … Continue reading

Read More