Create a child theme (if you haven’t already) and register two sidebars:
function wpse_151695_register_sidebars() {
register_sidebar(
array(
'name' => 'News',
'id' => 'sidebar-news',
)
);
register_sidebar(
array(
'name' => 'Blog',
'id' => 'sidebar-blog',
)
);
}
add_action( 'widgets_init', 'wpse_151695_register_sidebars' );
Then in your sidebar.php
:
if ( is_singular() ) {
// For single posts, show the sidebar relevant to the category it's assigned to.
if ( has_category( 'news' ) )
dynamic_sidebar( 'news' );
elseif ( has_category( 'blog' ) )
dynamic_sidebar( 'blog' );
} elseif ( is_category() ) {
if ( is_category( 'news' ) )
dynamic_sidebar( 'news' );
elseif ( is_category( 'blog' ) )
dynamic_sidebar( 'blog' );
}