<?php
// Register new sidebar with ID ==> biz-sidebar
genesis_register_sidebar( array(
'id' => 'biz-sidebar',
'name' => 'Buisness Kits Sidebar',
'description' => 'SideBar for Business Custom Post Type',
) );
add_action('get_header','riot_biz_sidebar');
function riot_biz_sidebar() {
if ( is_singular('business') || is_post_type_archive('business')) { // Here "biz" is a slug name for my CPT
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); //remove the default genesis sidebar
add_action( 'genesis_sidebar', 'riot_add_sidebar' ); //add an action hook to call the function for my custom sidebar
}
}
//Function to output my custom sidebar
function riot_add_sidebar() {
dynamic_sidebar( 'biz-sidebar' ); // id of sidebar which you just registered
}