• Skip to main content
  • Skip to primary sidebar

Purely Supplemental Hub

Just The Tech, News, and Info We Deem To Post

  • WordPress
  • Marketing
  • Business
  • Computing
  • Security
  • Publicity
  • Resources
  • WHATEVS

Add Unique Sidebar to your Custom Post Type

Add the following code to your WordPress theme’s function.php file, or a functionality plugin to add a unique sidebar to your Custom Post Type.

/** ADD Products custom sidebar  ********/

add_action('get_header','cd_change_genesis_sidebar');
function cd_change_genesis_sidebar() {
    if ( is_singular('products') || is_page( array( 42, 54, 6 )) || is_tax( array('products_category', 'products_tag')) || is_post_type_archive('products')) {
        remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
        add_action( 'genesis_sidebar', 'cd_do_sidebar' );
    }
}

/** Function to output products custom sidebar  ********/

function cd_do_sidebar() {
	dynamic_sidebar( 'products-single-sidebar' );
}

Filed Under: Code Snippets Tagged With: Code, Custom Post Type, Layout

Reader Interactions

Share Your Two Cents Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

© Copyright Jack Alltrade & Associates 2026 · Purely Supplemental™ is a trademark of Jack Alltrade & Associates