Roots and Modern Tribe's Events Calendar

I’m building a theme and want to integrate Modern Tribe’s Events Calendar. It appears the plugin has issues with the theme wrapper to output their specific scripts. The issue is very similar to how WooCommerce handles their templating system and butts heads with the theme wrapper. The result is scripts incorrectly output into the body content as well as the footer.

Has anyone successfully integrated The Events Calendar with Roots? I’m going to keep hacking away here to see if I can get it working so the scripts are output correctly. Any help or advice is appreciated!

http://tri.be/shop/wordpress-events-calendar/

See my post here: http://imdev.in/roots-theme-and-woocommerce-duplicate-header-fix/ for an example of what I mean about scripts incorrectly output within the body. (woocommerce used as example) same thing is happening with The Events Calendar…

I assume that the same fix for Woo Commerce doesn’t work for Events Calendar?

You would think that these plugins would be using wp_head to add things to the head, but perhaps they’re using a different hook. I think you’d have to find the hook they’re using and that would help diagnose how to fix the issue.

1 Like

OK - turns out the same solution DOES in fact work. For some reason when I initially tested it didn’t appear working. Just went back at it and created blank header.php, sidebar.php and footer.php and all is well again. I’ll update that article to state it does work for The Events Calendar as well.

That’s an interesting way of doing it. Never would have thought to do that.

I copied template-example.php and created a new template template-events.php and set that as the template in the TEC setting. Then I added some logic to roots_title() (in /lib/titles.php) to make sure I display the appropriate title on TEC pages. Let me know if you’re interested in this snippet and I’ll create a gist.

I believe this was all I needed to do to get it working but I will write a post about it once the project is complete as I added some customizations to the plugin itself that could be useful to others.

1 Like

I’m 8a bit late but hopefully this helps someone! I have recently integrated The Events Calendar into a number of sites. One of the best aspects of this plugin and WooCommerce is that you can over ride the templates by moving the files to your theme root. Copying the “views” folder from the plugin and naming it “tribe-events” achieves this.

Then you can just edit the default-template.php to remove the calls to the header/footer. That way you don’t have any empty .php file in your theme and have greater control over the templates, however if something breaks in the future you would need to manually update the files in your theme.

2 Likes

I’ve been looking into this myself and think I’ve found a solution. You can override the default template for Events Calendar pages by creating a file at

[your-theme]/tribe-events/default-template.php

I just copied the one from

the-events-calendar/views/default-template.php

then edited the copy in my theme folder and removed the get_header() and get_footer()
This fixed the issue I was having with a duplicate header and footer as well as the sidebar clearing under the main content because it wasn’t being written inside of the main content row div.

I’m going to continue investigating but wanted to share in case anyone had any thoughts on this way of doing it.

This was the first thing I tried but for some reason it did not work for me. I think I had AJAX issues. This was TEC 3.1 so I’ll give it a try again in a few days.

Thanks for letting us know :slight_smile:

What’s wrong with the creating blank header / sidebar / footer files approach? It’s been working for me without issue.

It just seemed a bit hacky to me to have to create several empty files in my theme folder as a workaround. Creating your own default template for the events calendar views addresses the issue directly.