The Events Calendar 3.0 Preview: Talking Templates with Jessica

This morning I sat down with Jessica Yazbek, a member of the core development team working on The Events Calendar/Events Calendar PRO 3.0, to review the new templates that are coming in the 3.0 release. Jessica has spent a good chunk of the past couple weeks working on rewriting the templates — based on feedback we’d received from support requests and beta testers alike — to make them more flexible.

In our talk this morning, Jessica walked through the changes she’s made and what you can expect from them. This is the first under-the-hood preview we’ve given so far and it should shed some light on what you can expect. Check out the video (less than 5 minutes long!) after the jump.

Pretty cool, right? Let’s review, using list view as our example to keep continuity with the video…

What’s changing and how the file is broken up

In the old list view, everything was in one file. It started with a wrapper, led into the header and the loop from there. The event single item was a big chunk of code within the list and repeated for every item in the event list; it would generate the same HTML for every event in the list. Underneath, it had the next/previous navigation and the iCal link. The big takeaway here should be that everything was all in one file.

In the 3.0 release, list view is still in the same location: plugin folder –> views –> list.php. But if you go into events –> views, you’ll see a list.php (the file that gets included first for list view — essentially the parent view file). Inside it, little pieces are called to handle each part of the view: for example, a template part for the tribe bar. We’ve included a new function: tribe_get_template_part. That is really similar to WordPress’ get_template_part function, and it looks in all the correct locations for tri.be templates. You’ll see includes like (‘modules/bar’), etc. The loop is also now in a separate file.

As an example: if you just wanted to add a div that wraps around the whole list, your approach will change in 3.0. Previously you would have been forced to copy the entire list file and make your changes there. But now you can merely copy this new file and leave the loop content alone, as it’s now included separately.

How to do an override

Overrides, then, have changed as well. You only have to override the piece you want to change — not the whole thing. Let’s say we want to override the list view so the next/previous links that appear before the loop were gone. To do this an override in the 3.0 codebase you’ll follow these steps:

  1. Create a new “tribe-events” folder in your theme directory.
  2. In that “tribe-events” folder, make a new folder called “list”.
  3. Inside the “list” folder, make a file called “nav.php”.
  4. Copy the contents of “nav.php” from the original “views” folder to your new file of the same name. (Note that we’re not copying the whole list.php file, as was the case previously).
  5. Delete the nav-centric code from this file and replace it with something simple; for example, a basic line of text saying “There is no nav.”
  6. Save the file, and refresh the frontend. Your navigation links will be replaced by that text we added.

Note that the rest of the template is untouched, and still pulling from the original plugin files. So when updates are released people will not need to update the entire list.php; they can keep using the version we’ve released and if they made modifications to the nav or any other small overrides, that’s all they’ll have to be responsible for maintaining.

One last point to keep in mind: in the old version, there was a lot of logic in the templates. This could be confusing for themers or other laymen, and made it a bit tough to scan as well. But for 3.0 we’ve moved a lot of that logic to template tags. So all you’ll have to do is throw out one template tag that does all this logic for you. Ultimately this means the templates themselves are also cleaner/simpler.

If you’re curious about anything else related to the templating structure, or if this raised questions in your mind that need an answer, let us know in the comments below.

Comments (28)
  1. Hi, I’m currently working on 2 sites that will go live in mid-June, using your Events Calendar (free version). Currently I’ve got V. 2.0.11 but it looks like major formatting changes are coming up, probably pretty close to our launch date. What would you recommend? Would it be possible for me to go with the beta 3.0 code and then load the actual plug-in 3.0 when it’s launched (last I saw, end of May?). I am doing a lot of customization to the views (events folder within my theme) and am concerned that these will be a bit of a mess after 3.0. Thank you!

    1. Hey Myrna. Thanks for the note here and for checking out the post. I can understand your position here and have seen a few questions along these lines. I will say that we’re fairly confident (but can’t guarantee anything) that 3.0 will be out by mid-June. If you are in a position where you have a staging site that you can work on, it would probably make sense to get the beta code (which I can send you if you email pro /a/ tri.be) and – once you’ve got the 2.0.11 templates where you want them – attempt to transpose those to 3.0.

      We definitely don’t recommend going live with beta code in place, but so long as you understand you’re doing so at your own risk and that we can’t provide support for problems with beta code, you could go that route too.

      Hope this helps. The good news is you’ll find the templating approach in 3.0 easier, so you won’t have to duplicate all your efforts in 2.0.11. If you have other questions here please do let me know.

      1. Hey Rob, great work on The Events Calendar 3. The new features look great, but I’m mostly looking forward to it from a developer point-of-view. I’m in the same boat as Myrna (and many other developers I guess) with regards to projects that are currently in development. I’m wondering if there are many changes since the beta where templating is concerned, and if so, do you have a more recent version that we could work with until 3.0 final is released? Thanks, and keep up the good work!

      2. Hey Emyr! What version of the beta did you have — specifically around when did you receive it? While the final round technically closed today, I do have a fresh batch (which incorporates Jessica’s changes, made around the second week of May) which I’d be happy to send you so long as you don’t need any support on it.

        Let me know if so and I’ll hook it up.

      3. HI ROB, i want to have something like http://www.ovs.fr and i think your product is perfect just one thing is missing, numer of persons that are invited to a event for example i want to propose to my users a bicycle ride but only for 30 personnes, and i want to see in the front page 8/30personnes its mean until now there is 8 personne who want to come and there is 22 free place left…

      4. Number of users invited to an event is a solid idea! It could probably be faked in some capacity with the stock functionality, but I could see value in this down the road. I encourage posting it to our UserVoice page (https://tribe.uservoice.com/), so others who share the enthusiasm can vote it up 🙂

        Thanks for the feedback!

  2. I like what I see, but have a few questions.
    1. Can a schedule be uploaded?
    2. Can the events uploaded allow for merchant system integration to “sell” the event?
    3. Any functionality to notify the seller and buyer of the event?
    4. Can this plugin manage multiple peoples’ calendars of event purchases AS WELL AS allow seller to see all purchasers’ purchases on a calendar?

    Thanks,
    Steve

    1. Hey Steve. Thanks for the note here, and for checking out this post. Happy to help you out best I can in terms of answering these questions:

      1. Do you mean something like a PDF schedule? If so, you could definitely upload a PDF and include it in the content description area. But there isn’t yet any method for uploading a CSV or something and having it convert to events.
      2. If you check out either the WooTickets or Eventbrite Tickets add-ons, you’ll see that they allow something along these lines: they link to your events and sell tickets for those events themselves. This is the only method we’ve got at the moment for charging to attend an event.
      3. Notifications aren’t built in from a commerce standpoint. But if users are submitting frontend events via the Community Events add-on, site admins can elect to receive a notification whenever a submission comes through.
      4. You can have multiple calendars in the sense that you can segment out your events into different categories, and target those events/categories towards specific viewers on the site. But there isn’t much in terms of managing the commerce side beyond what WooCommerce has built in.

      Hope that helps. If it doesn’t, or if you have other questions here, definitely let me know and I’ll get you what you need. Cheers!

  3. Is there a reason on 2.0 and apparently on 3.0 not to be using wordpress custom post types template hierarchy? Like archive-tribe_events.php and taxonomy-blablabla.php since the plugin uses custom post types and taxonomies natively in the admin? That allows obviously to work ith actions and get-template-parts. Or is the plugin using the template hierarchy and I just don’t know enought php to see it?

    Thanks for the great plugin!

    1. Hey Tiago. Good question. What would you be trying to do here, exactly? Replace the events page? Create a new view?

  4. Hi Rob,
    wow- it is looking great so far and I am looking a lot forward to it. On our site I changed quite a bit in the templating which will now be incorporated which is great. I would love to testdrive the version 3.0 because i might have to change quite a bit to make it work for our site. Will send you an email as mentioned above

    thanks
    kind regards Steph

    1. Hey Steph. I believe I emailed you the beta yesterday, but let me know if it never came through!

  5. Hi Rob,
    I would really like to try out my existing templates against the new version. Please send me a copy of the latest beta for me to play with.
    Thanks again for your awesome code!

    P.S. I won’t need any support. 🙂

    1. You had me at “I won’t need any support” 😉 All kidding aside though…happy to hook you up with it. Can you send an email to pro /a/ tri.be, and I’ll get it your way? Thanks for the support Mat!

  6. Greetings Rob – I’d be interested in the 3.0 beta as well if you could? I’m currently working through a couple of issues and would be great to see if they get resolved.
    Cheers,
    Patrick

    1. Hey Patrick! Thanks for the note here. I can hook you up on this end, sure – the beta itself is technically over, so I won’t be able to engage with feedback much or get anything logged to address for the initial 3.0 release (we’re in code freeze by this point). But if you’re sure you won’t need support for the beta code and are just using it for evaluation purposes…totally. Shoot an email to pro /a/ tri.be referencing this article and I’ll get you what you need.

  7. Thanks for this overview, Rob! Are y’all still slated for a mid-June release?

    1. Jaki: unofficially? We are 🙂 Don’t quote me on anything launch-related, since plans have been known to change based on gnarly bugs or other dev issues. But we’re truly down to the home stretch (finalizing our documentation, translations, etc) and I’m feeling confident that its a matter of weeks before this is out the door.

      Hope that helps. Let me know if it didn’t and I’ll definitely update my response to get you what you need.

  8. Hi Rob!

    I am working on kaheke.com, and am in the same boat as a lot of people who commented here and was wondering if it is possible to get the beta plugin so I can start developing with it. Is that possible?

    1. Hey Alyssa. Thanks for the note here; we’re out of the beta period, but if you email pro /a/ tri.be referencing this comment, I can float you a copy. It is definitely incomplete code and please understand that we can’t provide any support on it whatsoever at this point…but if you’re comfortable with that, it’s all yours.

      Hope that helps!

  9. Hello, I would like the new 3.0 files please. joann dot martin at icloud.com

    Also, will I need to modify the view to display featured image thumbnails, or is this already included by default?

    Joann Martin

    1. Hello Joann! We would be happy to float you a copy if you’re down to use it with the understanding we can’t provide any support (as it is a beta). If that’s cool, mind emailing pro /a/ tri.be so we can get you into our email system and fire off the code accordingly?

      Regarding the featured image thumbnails: you want this to show in list view, correct? If so, then that should appear by default. But let me know if I’m misunderstood on this end.

      Cheers!

  10. Looks great especially for us non-coders. Been waiting for 3.0 for a while to make some bigger changes. Looking forward to the release! Thanks!

  11. Hi Rob – from what I can tell EC 3.0 isn’t out yet? Wondering how you are going in terms of mid-June release? Far away?

    Cheers, Ed.

    1. Hey Ed! You are correct – we are indeed on the cusp. It’s a matter of days, not weeks, at this point!

  12. Are you able to send me copy of EC3? I would like to see if it will resolve the problems we are having with qtranslate. Thank you.

    1. Hey Roger! You’re welcome to give it a shot, though I can say with some certainty that sadly qTranslate integration is probably still busted. (I see we still have an unfinished ticket in our system to address it). Shoot an email to me at pro /a/ tri.be, referencing this post, and I’ll get you sorted. If you could do it by the end of the weekend that’d be awesome since — as of Monday — we’re officially not providing anymore beta code since we’ll be so close to release.

  13. Hi,
    I had a question about my sidebar calendar on the homepage of my website. I would like to organize the events by month and was wondering how to do so. Any help would be much appreciated.

Comments are closed.