Created
August 28, 2020 15:18
-
-
Save markdeafmcguire/3d83112e3e2cae9d2fa0c39e834abb66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** 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