Recently I had a client who needed an single “Add to Calendar” link on her site for an upcoming event. She didn’t want a full event plugin on her site since she rarely hosts events, but wanted her viewers to easily be able to add this event to their calendar. I searched for a plugin that would add this functionality but couldn’t find one that would do this without adding a whole calendar/event functionality.
But then I found AddToCalendar. It’s free and there are no ads that come with it. Just fill out your own info within the sample code and add to your site! The only thing will be a small addtocalendar.com link when people actually add it to their calendar, but for me, this wasn’t a problem. I suppose you could remove it from the script if you really wanted to, but it seems like a small price to pay to have it all written out for you.
I like that it has options to include Google Calendar, iCalendar, Outlook, Outlook Online and Yahoo! Calendar.
First, they give you a link to add to your header.php file:
<link href="http://addtocalendar.com/atc/1.5/atc-style-blue.css" rel="stylesheet" type="text/css">
If this is a problem for you, just visit the link, and copy and paste the CSS to your own style.css file or add it with a Custom CSS Plugin.
Next, add their simple script to your post or page in the TEXT editor:
<script type="text/javascript">(function () {
if (window.addtocalendar)if(typeof window.addtocalendar.start == "function")return;
if (window.ifaddtocalendar == undefined) { window.ifaddtocalendar = 1;
var d = document, s = d.createElement('script'), g = 'getElementsByTagName';
s.type = 'text/javascript';s.charset = 'UTF-8';s.async = true;
s.src = ('https:' == window.location.protocol ? 'https' : 'http')+'://addtocalendar.com/atc/1.5/atc.min.js';
var h = d[g]('body')[0];h.appendChild(s); }})();
</script>
<!-- 3. Place event data -->
<span class="addtocalendar atc-style-blue">
<var class="atc_event">
<var class="atc_date_start">2015-05-04 12:00:00</var>
<var class="atc_date_end">2015-05-04 18:00:00</var>
<var class="atc_timezone">Europe/London</var>
<var class="atc_title">Star Wars Day Party</var>
<var class="atc_description">May the force be with you</var>
<var class="atc_location">Tatooine</var>
<var class="atc_organizer">Luke Skywalker</var>
<var class="atc_organizer_email">luke@starwars.com</var>
</var>
</span>
No need to add this to the special scripts section, just add it right into your TEXT editor.
You’ll need to customize the second part with your own event info. If you’re an American like me, remember that the sample date is May 4th and NOT April 5th! It goes year-month-date.
Be sure to test it to make sure it works! I got messed up on the timezone part, but just visit their site and click on the Event data options tab near the bottom. There you will see a dropdown where you can find your correct timezone. I had forgotten to put the underscore where the space is in “New York”.
Since I added the CSS to my own style.css file instead of linking to theirs, I was able to customize it so my button is pink instead of blue. But they have several options of style sheets you can link to so you can options of pure text or even icons. Check it out and let me know what you think!
NOTE: You must do all of your edits in the TEXT editor. If you switch over the visual editor, WordPress will automatically disable this code.