My theme holds below code in sidebar.php. I want to now make sure I can show a different sidebar when someone is viewing a custom taxonomy.
//Default sidebar
$selected_sidebar_replacement = 'Sidebar Widgets';
//If is page or single
if(is_singular()){
global $wp_query;
$post = $wp_query->get_queried_object();
$selected_sidebar_replacement = get_post_meta($post->ID, 'sbg_selected_sidebar_replacement', true);
//If default selected
if($selected_sidebar_replacement == '0' || $selected_sidebar_replacement == ''){
$selected_sidebar_replacement = 'Sidebar Widgets';
}
// Reset the global $the_post
wp_reset_query();
}
I've already tried the below (above //If default selected), where "product-brand" is the slug of the custom taxonomy and where "Gear" is an existing (and working on other pages) sidebar, but it didn't work. Any suggestions would be appreciated.
if(is_tax( 'product-brand' )){ $selected_sidebar_replacement = 'Gear'; }
Full sidebar.php code on pastebin: http://pastebin.com/CLD9DrUz
