An Alternative Sidebar Page Template in Genesis

There are plenty of methods to achieving different sidebars on specific pages, even switching sidebars in Genesis. One I like for simplicity uses the Secondary Sidebar in Genesis as the alternate sidebar – rolled into a page template.

The default description for the built-in secondary sidebar doesn’t really apply, so first we’ll unregister that sidebar and re-register it with our preferred description. Place this in your child theme’s function.php file:

* Place this into your functions file
unregister_sidebar( 'sidebar-alt' );
'id' => 'sidebar-alt',
'name' => 'Alternate Sidebar',
'description' => 'This sidebar will appear instead of the primary sidebar, when the alternate sidebar page template is used.',
view raw functions.php hosted with ❤ by GitHub

Then create a new page template, called something like template-alt-sidebar.php for instance, with the following code:

Template Name: Alt Sidebar Page
add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );

Now you’ll see the secondary sidebar in your widget area with a proper description and have a page template for the pages you want that sidebar to appear on. Plus, it uses the built-in Genesis sidebar name and hooks for ease and compatibility.

Obviously this template only works with single sidebar layouts. It will still allow you to use double sidebar layouts on other pages, though. If you are looking to make your sidebars and widgets more page-specifics, consider using the Display Widgets plugin, which allows you to choose where each widget in the sidebar is displayed.