Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.