UPDATE: After further testing on a recent project, I’ve found that this method still wasn’t a full solution, as the events list view still fetched the default content/sidebar layout.
There’s a more suitable filter to hook into to force the layout
The challenge: display the main events page with the full width template, and the single events with the default Genesis layout.
It took me a while to figure this out, so I want to write it down while it’s fresh in my mind and hopefully it can save someone else some time and grief.
I first played around with the Tribe custom templates, explained in detail here:
This does not work with Genesis.
Then I found this lengthy tutorial from Tribe themselves and thought I was saved.
This solution does not work anymore. Well, it has part of the solution which is the
The strange thing is that the filter wasn’t getting fired on the Events pages. I did a search for that filter in the Genesis code, but couldn’t find it, even stranger. Turns out the last part of the filter name is actually a variable, so that’s why I couldn’t find it!
What it does is allow you to filter any Genesis option dynamically, you just need to know the option key – in this case ‘site_layout’.
Ok, so with this knowledge, why isn’t the filter firing for this particular option? Well, I figured that the plugin didn’t know about it, and that made me remember a code snippet from wpsmith that enables Genesis layouts on custom post types. By the way, bookmark that site, it’s awesome. Thanks Travis!
This is what I ended up with
Ok, now the next step was to set the option for the ‘tribe_events’ custom post type. Just go to a single event, and select the layout you want, then save. This will set the ‘site_layout’ option for this post type enabling the genesis_pre_get_option_site_layout filter to fire.
Now just use this snippet to force a layout for the calendar view:
EDIT: if you’re forcing the layout to full width content, you may need to disable the sidebars as an extra step. I don’t know why they are being displayed though.
That’s it. An essential part of being a good WordPress developer is the ability to remember solutions you used in the past and adapt them to solve new problems