Set default layout for a Custom Post Type with Genesis

I have recently (yesterday) taken the plunge into building my websites with Genesis. I’m not exactly sure why I’ve been holding out. Most likely because I had built my own kind of framework and really like some specific things I had built into it. The problem is that I just don’t have time to work on all the other stuff that’s important for a good theme framework. So now I’m using Genesis and I couldn’t be happier. I still needed to solve a problem though so here it is.

I wanted my default layout to be CONTENT-SIDEBAR but I wanted a particular post types archives and single posts to be SIDEBAR-CONTENT. With the Genesis genesis-cpt-archives-settings custom post type support I can accomplish this for the archive pages but not for the single posts. This snippet solves that problem.

function wpnj_cpt_layout() {
    if( 'your_post_type' == get_post_type() ) {
        return 'sidebar-content';
    }
}
add_filter( 'genesis_site_layout', 'wpnj_cpt_layout' );

This code checks what custom post type you are viewing and applies this layout if it’s the one you’re looking for. Pretty simple.