Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjking/3739374af5a210df340d to your computer and use it in GitHub Desktop.
Save brianjking/3739374af5a210df340d to your computer and use it in GitHub Desktop.
<?php
genesis_register_sidebar( array(
'id' => 'id-of-new-sidebar',
'name' => __( 'Blog Category Page Sidebar'),
'description' => __( 'This is the blog category page sidebar section.' ),
) );
add_action( 'get_header', 'child_sidebar_for_page' );
function child_sidebar_for_page() {
if ( is_category('blog') || is_single() ) {
remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
add_action( 'genesis_after_content', 'get_sidebar_for_page' );
}
}
function get_sidebar_for_page() {
echo '<div id="specific-id-of-new-sidebar">';
genesis_before_sidebar_widget_area();
dynamic_sidebar( 'id-of-new-sidebar' );
genesis_after_sidebar_widget_area();
echo '</div>';
}
?>
http://digitcodes.com/show-custom-sidebar-for-specific-pages-in-wordpress-using-genesis/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment