Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save markdeafmcguire/3d83112e3e2cae9d2fa0c39e834abb66 to your computer and use it in GitHub Desktop.
Save markdeafmcguire/3d83112e3e2cae9d2fa0c39e834abb66 to your computer and use it in GitHub Desktop.
/*
** Conditionally force the Genesis Framework Layout on specific post types including Custom Post Types (CPTs)
**
** Instructions:
** 1) Replace themeprefix with your own prefix
** 2) Keep or replace post types inside array brackets. The example placeholder here is "treatment".
**
** Source: https://wpbeaches.com/force-custom-post-type-certain-layout-genesis-theme-wordpress/
*/
add_filter( 'genesis_site_layout', 'themeprefix_cpt_layout' );
// Force a layout
function themeprefix_cpt_layout() {
if ( is_singular( array( 'post', 'treatment' ) ) ) {
return 'content-sidebar';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment