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.

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.

Comments

  1. Tom says

    One of the great things I’ve found about Genesis are the number of quality plug-ins that are available to do things without having to code for results. There’s certainly nothing wrong with adding code, but the plug-ins are an instant go-to solution and most offer easy what-if sampling and other options. You can also use them from site to site where you may be using different Genesis themes.

    For instance, you should be able to get the same results for your CPT using David Decker’s “Genesis Layout Extras” plugin, which offers a layout selection per CPT and adds layout options not offered by Genesis. Even though Genesis has up to 6 layouts, David’s plugin adds at least 3 additional layouts and adds 9 additional layouts if your theme supports alt-sidebars (secondary sidebars).

Leave a Reply

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