Skip to content

Instantly share code, notes, and snippets.

@QROkes
Created March 18, 2016 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QROkes/a6bb16224b1b5456f874 to your computer and use it in GitHub Desktop.
Save QROkes/a6bb16224b1b5456f874 to your computer and use it in GitHub Desktop.
Genesis Simple Sidebars for Custom Post Types (WordPress + Genesis Framework)
<?php
add_action( 'genesis_before_sidebar_widget_area', 'qr_remove_default_sidebar' );
function qr_remove_default_sidebar() {
if ( get_post_type() == 'my-cpt' ) { // set CPT here
remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'qr_add_cpt_sidebar' );
}
}
function qr_add_cpt_sidebar() {
dynamic_sidebar( 'my-sidebar' ); // set the simple sidebar here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment