Swapping Sidebars in a Genesis Template

If you do any sort of complex development using the Genesis framework you will likely find yourself requiring additional sidebars outside of the packaged primary and secondary sidebars. Typically I’d recommend using the Genesis Simple Sidebars plugin.

But for some that might seem like overkill when you only require a single additional widget area on a single page template, and for that purpose I’d agree. This is how I handle swapping out sidebars in a Genesis child theme.

Context:
For the project that I’ll be using as an example I had a custom post type that required a custom post template to display the single posts for this post type. On these pages I needed a new widget area that would accommodate several widgets specific to the posts.

Step 1
First thing you’ll want to do is register your new widget area, pretty basic knowledge required. For example:

Step 2
The following two functions are added to my child theme’s custom single template, e.g. single-custom_post.php. Keep in mind that my custom post type required a custom template for other reasons so I am adding these functions directly to the template. This isn’t necessarily required as these functions could be used in your functions.php with some modification.

Please read the code comments for an explanation of each.

You should now have a fully functional custom widget area on your single-post_type.php custom template.

And like I said, for anything more complex I’d definitely recommend that you check out the plugin I mentioned above.

Please consider sharing this post, discussing it with me on Twitter, or shoot me an email jeremy[at]papertreedesign[dot]com.