Adding a Downloadable Calendar Event File to Wordpress without a Plugin

on March 19, 2018

Let’s say you’ll be doing an event soon – say a Facebook Live event– and you want to create a calendar reminder for folks to download. Lots of us live and die by calendar invites, so this can be helpful to get people to attend.

It seems like it’d be an easy enough thing to generate a file for this invitation and embed it on a Wordpress page, but I managed to mess this up six ways to Sunday recently.

Here’s what I goofed up, and how I got it working.

Note: if you want to skip the long story, there’s a recap of the steps that work at the end of the post.

Generating an invitation file - what not to do on a Mac

I use a mac, so my first attempt was to generate the file using iCal, aka Calendar.app.

I created the event, and then right clicked, and I didn’t see an ‘Export’ option. So I went looking up in the ‘File’ menu and found an ‘Export’ option. DON’T USE THAT!

I thought that would export the event I had selected. Nope, that exports the ENTIRE CALENDAR you’re on. And if you’re me, that means that after you test this file yourself, and it looks normal, you then ask others for a quick test on Twitter and find that you’ve shared events such as “Meatloaf Eating and Motorcycle Racing”, “Kendra eye surgery with Jeremiah as magnificent chauffeur”, and “Paws Cut Off” along with your intended event.

And by the way: my dogs have all their paws, one of them is just a real drama queen every time he gets his nails clipped.

Luckily, I don’t use that calendar for business, so it was only chunks of my personal life that I exposed. While we’re being open, I’m going to also share with you, dear reader, that I find botox very effective at temporarily removing forehead creases. Everyone may as well know.

After quickly deleting that file and clearing every single cache I could find related to my webserver, I tried again! After all, I probably wasn’t going to make this worse.

Generating an invitation file - a better attempt on a Mac, but still not great

This time, I right clicked on the event in iCal, selected “Mail Event”, then saved the attachment from the email.

I also added the extra step of going to the saved .ics file and opening it in a text editor to verify that it contained only a single event, and not my entire personal life (or lack thereof). WHEW, it only had the one event. (I highly recommend this step!)

But I found this still wasn’t perfect. It worked well on iOS, but my friend Steve Jones found that this didn’t open as an invite for him on Outlook 2016, but instead popped up a separate calendar under my email address which he could add as a calendar.

I didn’t want a calendar, I wanted an invite!

What worked: generating the invitation file from my O365 account

I am lucky enough to have a free O365 account as part of my MVP benefit from Microsoft. Joey D’Antoni reminded me of that, so I logged in there and opened the calendar app.

I set up an event in that calendar, but couldn’t find any “export” or “save event file” on the online GUI. So I right clicked it, selected “Forward”, and sent it to my work Gmail account.

Once I got the email, it had a nice .ics file attached. I saved that file, edited it with a text editor and made the MAILTO address in it my work email address (my O365 email address is something hilariously weird), saved it, and tried that file.

This .ics file opened properly as an invitation (not a separate calendar) even in Outlook 2016.

I have not tested, but believe this would also work with a free account at Outlook.Live.com (the artist formerly known as Hotmail).

There’s still one weird thing left! Uploading the .ics file to Wordpress

I’ve saved one little gem for last. When you are using the Media Library in wordpress to add new files, if you click the ‘Add New’ button and then browse to your file, the .ics file will appear grayed out and you cannot select it for upload.

It looks like you just can’t do it.

But, if you simply drag the .ics file over into the media library, it uploads fine!

Just don’t use the ‘Add new’ dialog.

No. Idea. Why. I’m just going with it.

Recap: my process for generating and uploading calendar / event reminder files to Wordpress

The next time I have to do this, I’ll have forgotten all of this. So here’s my cheat sheet for myself (and hopefully for some strangers on the internet who need this):

  • Create an event in O365 (or another Outlook friendly app, such as Outlook.Live.com) for your event. Make sure you have the duration correct, etc.
  • Right click, select ‘Forward’, and send it to a different account (I used my gmail account).
  • Open the email. It will have a .ics file as an attachment. Save this file.
  • Right click on the .ics file and open it with your favorite text editor. Find the MAILTO: email address and change it to your preferred email, if desired. Save the file
  • Upload the file to Wordpress by dragging the file into the Media Library (the ‘Add New’ dialog doesn’t like .ics extensions, but this works for now at least)
  • Copy the link off the uploaded file and use it in posts/pages/etc.
  • Profit

There is probably an easier way to do this if you use ‘real’ Outlook, but that ship sailed for me years ago. (Nothing personal, Outlook, I hear a lot of people love you.)