I have an archive template ("archive-reviews.php") for a Custom Post Type I have created. I'd like to replace the default archive sidebar with a different one that I have created using the Genesis Simple Sidebars plugin.

The code I am using in the template file to do this is as follows:

remove_action('genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'bge_get_blog_sidebar' );

function bge_get_blog_sidebar() {
    dynamic_sidebar( 'chefsrecipes' );

I don't think this is relevant, but I have also added the following code to my functions.php file:

 add_post_type_support( 'reviews', 'genesis-cpt-archives-settings');
 add_post_type_support( 'reviews', 'genesis-simple-sidebars' );

The new custom sidebar is appearing, BUT the default sidebar is still appearing below the custom sidebar.

How do I get it to disappear?

1 Answer 1


I have this post and the response from David Chu to thank for enlightening me.

There is nothing patently 'wrong' with the way that I implemented this. The reason that it doesn't work is because of the fact that I have both the Genesis Simple Sidebars plugin and the Genesis Woocommerce Connect plugin installed.

Both of these make use of different Action Hooks to display the sidebar.

For Simple Sidebards you need to use:

remove_action( 'genesis_sidebar', 'ss_do_sidebar' );

..and if you have Genesis Woocommerce connect installed you need to use:

remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );

So my code in functions.php now looks like this.

function bge_swap_sidebar() {
  if ( is_singular('reviews' ) || is_post_type_archive( 'reviews'  ) ) {
    remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );
    add_action( 'genesis_sidebar', 'reviews_sidebar' );

function reviews_sidebar() {
    dynamic_sidebar( 'chefsrecipes' );
add_action( 'genesis_before_sidebar_widget_area', 'bge_swap_sidebar' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.