iCal Events Plugin

Note: This plugin is no longer being updated. You may wish to try amr-ical-events-list instead.

I also uploaded a plugin which displays events from an iCal source: iCal Events. It uses import_ical.php from the WebCalendar project. Many thanks to them for writing a parser.

Update (2006-04-17): Version 1.5 released, with support for some types of repeating events and support for event URLs. If you were previously using version 1.4 of the plugin, please note the following API change: the display_events takes a single argument, formatted as a query string. For example, if you are invoking the function as follows:

ICalEvents::display_events('http://www.ufl.edu/calendar/ufCalendar.ics', time(), NULL, 3);

you’ll need to change this to:

ICalEvents::display_events('url=http://www.ufl.edu/calendar/ufCalendar.ics&limit=3&gmt_start=' . time());

This change was made to make the plugin more flexible. You now have much more control over the output; for more information, please see the readme for version 1.5.

Update (2007-04-09): Version 1.12 is out; download it from the WordPress plugin repository.

Update (2008-04-15): Adam Wolfe Gordon has another plugin of same name that might fit your needs if mine doesn’t.


Comment from Carla on

Groovy tunes! Thank you!

Comment from Ghworg on

Excellent plugin, thanks.

Comment from Josh on

This is great, but it doesn’t seem to parse events with a “Custom” repeat setting (eg, every Tuesday and Thursday from 11-12). It picks up single events just fine, but not the repeated ones. I notice that several parsers aren’t implemented in import_ical.php; is this the problem?

Comment from dwc on


You’re right – it looks like only some of the RRULEs are implemented in the parser.

However, my WordPress plugin does not currently account for RRULEs, so for those that are implemented it might be returning incorrect data. Could you provide a sample ics file? (Please provide a link or email it to dwcNO@SPAMufl.edu.)

Comment from Jeremiah on

Is there any way to display an event’s location and comments?

Comment from dwc on


Glancing at the parser I’m using, I don’t think it supports those fields. Could you provide a sample ics file (email it to dwcNO@SPAMufl.edu.)

Comment from adame on

Got this stuff while using the script for some days:

Warning: mktime(): Windows does not support negative values for this function in ..wp-contentpluginsicalimport_ical.php on line 194

Any suggestion for how to make it righ? Thanks

PS.: I’m using the last release found at http://dev.wp-plugins.org/browser/ical-events/trunk/?rev=3906

Comment from Junap on

btw, the example URL given in the readme DID work! Is it perhaps something to do with .Mac?

Comment from tanster on

Wow — just uploaded your latest version and the URL field works BEAUTIFULLY.

Feel free to point to my pages (from my previous post) as examples of your awesome plugin at work.

Thank you again, Daniel. You rock!

🙂 tanster

Comment from Sokrates_d on

I notice in the readme Google Calendars are mentioned as a source of ical events.

I have tried the ical link in my Google Calendar as a source URL, but it doesn’t seem to work. Is this because the Google links don’t end in “.ics”, or am I being dim?


Comment from Sokrates_d on

oops – yes I was being dim – forgot “url=” in source URL.

Sorry 🙂

Comment from kwirq on


Your plugin is fantastic and thank you very much for it.

One problem: it’s displaying my events in the time zone of my web server (GMT-4), which is two hours ahead of me. How can I display them in my own time zone?

Comment from dwc on


Currently the plugin has no concept of time zones. I’m swamped with UF stuff at the moment, so I’d greatly appreciate a patch.

Comment from Pete Allen on

Repeating events by default repeat twice: once in the $events array, and once in the $repeats.
Small patch to correct this (it might not be the best way, but it seems to work. I only test against google calendar though):
function collapse_repeats($events) {
$repeats = array();

foreach ($events as $event) {
if (isset($event[‘Repeat’])) {
$r = ICalEvents::get_repeats_between($event, $gmt_start, $gmt_end);
if (is_array($r) and count($r) > 0) {
$rr = array_slice($r, 1,count($r) – 1);
$repeats = array_merge($repeats, $rr);

return $repeats;

Comment from dwc on


I’ve committed a fix for this to trunk. Please let me know if it works for you.

Comment from Pete Allen on

I’ll check it out later today.
Meanwhile I fixed a problem with imported ical’s from google calendar where it has the duration of a repeat event in seconds, which wasn’t supported. This is a patch for import_ical.php from line 108-115:

elseif (preg_match(“/^DURATION[^:]*:(.+)s*$/i”, $buff, $match)) {
$substate = “duration”;
$durH = $durM = $durS = 0;
if ( preg_match ( “/PT.*?([0-9]+)H/”, $match[1], $submatch ) )
$durH = $submatch[1];
if ( preg_match ( “/PT.*?([0-9]+)M/”, $match[1], $submatch ) )
$durM = $submatch[1];
if ( preg_match ( “/PT.*?([0-9]+)S/”, $match[1], $submatch ) )
$durS = $submatch[1];
$event[$substate] = $durH * 60 + $durM + $durS / 60;

If I get round to it I might add code to allow the events to be displayed as “This week” “Next week” “Next month” style.

Thanks for all the work on this! It’s a really useful plugin..


Comment from Brian on

Is there a way to display the time the events ends? Seems I can only get the starting time.

Comment from dwc on

The end time should be displayed if it is different than the start time. Could you email me a link to or a copy of the calendar which is causing problems?

Comment from Brian on


Comment from Zodiac on

Hello Daniel,
I’m testing your Plugin to provide an Event-Calendar-Page.

Three different programs/plugins that creating an ics-File:
Mozilla Sunbird (german)
and these two plugins:

The Sunbird ics-File seems to have a failure, because all Events are repeated three times.

The EventCalendar-Plugin ics-File didn’t display the events day if the events is on today. (This is displayed on May 29 when event is on May 29)
* 29. März 2006: Programmtest Zwei
* : Programmtest

Only the WP-ICal-Plugin seems to function without problems. But there I have to set the timestamp AND the Start/End-Time for the Plugin to have my EventCalendar.

Is there any chance to make your plugin work with Sunbird-ics-Files or to make the day visible if it is today?

Comment from Zodiac on

Got my mail?

Comment from Conrad on

Hey ~ You’re plugin was just what I was looking for, but I seem to be doing something wrong since it doenst work. I get this error: Warning: fopen(url=http://www.epiphanyeyc.com/phpicalendar/calendars/EYC%20Events.ics&limit=3&gmt_start=1151284259) [function.fopen]: failed to open stream: No such file or directory in /home/epiphany/public_html/wp-content/plugins/ical-events.php on line 102
Error opening url=http://www.epiphanyeyc.com/phpicalendar/calendars/EYC%20Events.ics&li

I’m 100% positive that the url is correct…so why isn’t it working?

Comment from dwc on


It sounds like there is a problem in your display_events call. Try this:

<?php ICalEvents::display_events('url=http://www.epiphanyeyc.com/phpicalendar/calendars/EYC%20Events.ics&limit=3&gmt_start=' . time()); ?>

Comment from Conrad on

Thats exactly the same php code that I already have. For any reason could it be the space in the filename? I don’t see why that would be a problem but thats the only thing I can stick out. I have to go right now but when I’m back I’ll try removing the space in the filename.

Comment from dwc on


Ah, I missed that last night. Try the following:

<?php ICalEvents::display_events('url=http://www.epiphanyeyc.com/phpicalendar/calendars/EYC%2520Events.ics&limit=3&gmt_start=' . time()); ?>

Comment from Conrad on

Ok that didnt work either – but I tried taking the space outta the file…its displaying the events now, but it seems there’s in error in my ical file itself – Unsupported iCal COUNT value “COUNT=2”
Unsupported iCal COUNT value “COUNT=2”
# Sun Jun 25 – Sun Jul 2: Mission Trip – New Orleans
# Mon Jun 26 – Mon Jul 3: Mission Trip – New Orleans
# Tue Jun 27 – Tue Jul 4: Mission Trip – New Orleans

Unsopported iCal COUNT value “COUNT=2” ?
What does that mean?

Comment from dwc on

Unfortunately the code used to parse iCalendar data does not support all the different types of repeating events. I haven’t had time to add support for this type yet.

Comment from Conrad on

Ok thanks though. I worked on the ical-events.php to get it to view some of my repeating events more accuratly. This is an awesome plug-in. Thanks for the hard work.

Comment from Conrad on

I thougth I might let you know, i modified the 2 php files and it seems to be displaying repeating events correctly. You can see it at http://epiphanyeyc.com – in the brown column on the right. The main thing i did was remove the error handlers in the parser and a few things in the events file…I didn’t do much so I don’t understand why it would work…but it seems to work just the way I wanted it to…I’m sure it doesn’t but it works better than it did before.

Comment from dwc on


Thanks for the info. I’ll try to take a closer look soon.

Comment from matt b on

Is there a built in way to consolidate events for a given date? That is to say, if there are two events on the same date, only show the date once.


Comment from dwc on


There’s no built-in way to do this currently. I’d suggest that you use ICalEvents::get_events to write a custom display function. You can put it in your own plugin:

Plugin Name: My iCal Events
function my_ical_events_display($url, $gmt_start, $gmt_end, $limit) {
    $events = ICalEvents::get_events($url, $gmt_start, $gmt_end, $limit);
    $output = '';
    foreach ($events as $event) {
        /* Custom view code here */
    return $output;

Comment from matt b on

thank you for the information. will do.

Comment from Farhan on

How do I display displays from the current day, and not just from the current time forward?

Comment from dwc on


Try the following parameters for gmt_start and gmt_end:

$time = time();
$gmt_start = mktime(0, 0, 0, date('m', $time),date('d', $time),date('Y', $time));
$gmt_end = mktime(23, 59, 59, date('m', $time),date('d', $time),date('Y', $time));

Comment from wes on

I’m trying to implement iCal Events into my new blog… but I get this error..

Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /home/.kazak/wyoakum/twentyeight19.org/wp-content/plugins/ical-events.php on line 150

I’m using Dreamhost… apparently they have disabled fopen for security reasons. Also, I’ve seen that this has been a problem with a number of different plugins… with differing solutions… possibly using cURL? I’m not too sure… I’m no programmer… so, for me, ideally there would be a section of code in ical-events.php that I could replace to make it work.

If you have a chance, could you help me out with this? If you can’t get to it, no problem. Just let me know so I can know to keep on looking for a solution. Thanks for all the good work!

Comment from wes on

dwc –

thanks for the help… i’m not sure I can get to it today. But, I’ll give it a shot as soon as I can.

Thanks a ton.

Comment from wes on

dwc –

actually, I realized how easy that would be and went ahead and tried it out.

I haven’t tried customizing the output or anything… but, good news… it seems to be working fine! I first just used the example from the readme file… which worked… so then I tried it quickly with a couple of different google calendar iCal feeds and those worked great too.

Thanks for the help! I will get around to trying to customize the output and such soon.

by the way, you can see my implementation at…


obviously, I’m still working on the site though, so cut me some slack 😉

Comment from dwc on


Looks good! Thanks for testing out the development version.

I’ve released version 1.8 of the plugin (no functional changes from the development version).

Comment from emeff on

Great plugin: I love it. Thanks!

I have just one wish: I would like to display the previous event from now and the next following events (limit=3), but I can’t ‘fetch’ the previous event with the ‘start date’ tag, because it’s an unknown amount of days away.
To make it clearer: I have an Google Calendar that includes the events of my favourite hockey team and after every game I add the results (scores). With iCal Events I want to display the result of the last game (2 to 6 days ago) and the following 2 game (preview). GMT_START will not help (IMO) because it captures not exactly the last event.
Is it possible to deliver a solution for this requirements? Thanks for any feedback!

Comment from dwc on


For that type of situation I recommend using the ICalEvents::get_events function. It’ll be a little more work, but will give you complete control over the output.

See an above comment for a bit of sample code. Good luck!

Comment from Eric on

Seems not working any more after new updates. New version available yet?

Comment from dwc on


Are you receiving an error message?

Also, are you using the url-cache plugin?

Comment from Mark on

Cool plugin!

Any news about the ‘Unsupported iCal COUNT value “COUNT=2?’ message? I’m also getting this message. Any idea if and when this will be implemented? Any patch I can apply?


Comment from dwc on


At the moment events that repeat using COUNT are not supported. Sorry!

I’d love it if someone came up with a patch to support these events; if you’re interested, email me and I’ll help you get started.

Comment from lars on

Nice plugins, thanks!

Comment from Dan on

Is there any way to get links from my Google Calendar description field to import correctly? It does everything great, but in the description field I have a few links for each event that display as html.

Comment from irry on

Hi Dan, the download you are offering on the official wordpress plugins site is 1.12. On this page you are offering 1.5 (top of page) and 1.8 further down this page (dated August 20th, 2006). Is 1.8 the one you would prefer us to use?

Comment from dwc on

Dan: I can’t get Google Calendar to accept HTML in the description field. When I try to enter a link (e.g. <a href="http://www.ufl.edu/">UF Home Page</a>), it strips it.

RFC 2445 doesn’t explicitly disallow HTML but it does say that the description field should be for human-readable text. Could you provide a link to the calendar you’re trying to display (email me if it isn’t public) and an example of how you’d like it to show up?

irry: 1.12 is preferred, I’ve updated this post to reflect this. Thanks!

Comment from justine on

Hey! I just added this plugin to my wordpress, and the default events show up just fine. But, when I try to display my google calendar events, I get an error:

“iCal Events: Error parsing calendar [http://www.google.com/calendar/ical/jrjvl31o7cs2v101avm28ru95s@group.calendar.google.com/public/basic.ics]”

When I un-commented the parser debugging code in import_ical.php, it shows the correct calendar title, description, timezone, etc. What could be the problem? Did I forget an important step? Thank-you!

Comment from dwc on


Could you let me know what version you’re using and what code you’re using to invoke the plugin?

The following worked for me using version 1.12:

<?php ICalEvents::display_events('url=http://www.google.com/calendar/ical/jrjvl31o7cs2v101avm28ru95s@group.calendar.google.com/public/basic.ics&limit=3&gmt_start=' . time()); ?>

Comment from Benjamin on

I made two modifications to ical-events.php
1) added force reload:
in function function cache_url($url)
change if (! file_exists($file) or time() – filemtime($file) >= ICAL_EVENTS_CACHE_TTL) {
if (! file_exists($file) or time() – filemtime($file) >= ICAL_EVENTS_CACHE_TTL OR $_GET[‘ical’] == ‘reload’) {

now when you call your url with ?ical=reload it will force a reload

2)for gcal, added linkify description
modified or added the following lines
if (! isset($r[‘link_description’])) $r[‘link_description’] = true;
if (! isset($r[‘link_text’])) $r[‘link_text’] = ‘Link’;
ICalEvents::do_display_events($r[‘url’], $r[‘gmt_start’], $r[‘gmt_end’], $r[‘limit’], $r[‘date_format’], $r[‘time_format’], $r[‘before’], $r[‘after’], $r[‘before_date’], $r[‘after_date’], $r[‘use_summary’], $r[‘before_summary’], $r[‘after_summary’], $r[‘use_description’], $r[‘before_description’], $r[‘after_description’], $r[‘replace_newlines_with’], $r[‘use_location’], $r[‘before_location’], $r[‘after_location’], $r[‘use_url’], $r[‘echo’], $r[‘link_description’], $r[‘link_text’]);
function do_display_events($url, $gmt_start, $gmt_end, $limit, $date_format, $time_format, $before, $after, $before_date, $after_date, $use_summary, $before_summary, $after_summary, $use_description, $before_description, $after_description, $replace_newlines_with, $use_location, $before_location, $after_location, $use_url, $echo, $link_description, $link_text) {
if ($link_description == 1) {
// add link_description
$event[‘Description’] = ‘‘.$link_text.’‘;
$output .= str_replace(“n”, $replace_newlines_with, $event[‘Description’]);

now in the php code in your sidebar, add &link_description=1&link_text=Goto or whatever. This of course only works when the description field only contains a link. I suppose with a preg_replace I could be fancier or somesuch, but this works for me

Comment from Benjamin on

i decided to make it a bit easier to work with and robust when linkifying the description. I removed link_text and changed
106 to
if ($link_description == 1) {
// add link_description
$bblink = array(‘[[‘,’][‘,’]]’);
$htmllink = array(‘‘,’‘);
$event[‘Description’] = str_replace($bblink,$htmllink,htmlentities($event[‘Description’]));

Comment from Benjamin on

Is there some kind of limit on the description length? I’m getting my ics from google cut off and I think it has to do with the description field

Comment from dwc on


Not that I know of. A few of my events have a long description on Google Calendar and they come across okay.

Could you provide an example of the behavior you’re seeing or maybe even a link to the calendar so I can check it out?

Comment from Benjamin on

just to be sure, i sent some patch code earlier and i’m not sure it posted, maybe caught as spam?

Comment from Benjamin on

here’s the source http://jewishmeetup.com/chicago/ical-events.phps (the directory is my page though I admit that I manually downloaded that ics file as for some reason it wasn’t completely downloading. is that an issue with the wp_remote_fopen ?) two changes: manual reloadwith ?ical=reload and bbcode links in the description

Comment from dwc on


Your first two comments were marked as spam – sorry about that!

I like your idea for allowing a manual reload of the calendar. It should probably be restricted to administrators, so malicious users can’t get you in trouble with another server.

On BBCode processing, my initial feeling is that it should be left to another plugin or template function. For example, with your WordPress theme you can provide a functions.php file. In this file you could write a mytheme_bbcode_links function that replaces the appropriate patterns with HTML links and then wrap your ICalEvents::display_events call:

echo mytheme_bbcode_links(ICalEvents::display_events('url=...&echo=false'));

Comment from Benjamin on

Without creating an admin page, I thought I could check something like this
if ($_GET[‘ical’] == ‘reload’ && !empty($_COOKIE[USER_COOKIE]) &&
to see if the user calling the ?ical=reload is authorized as an admin, but I don’t know how to specify the user level (wp_getuserinfo)?

anyhoo, great plugin. still need to figure out why it’s not downloading the whole ics from google…

Comment from Benjamin on

fwiw, I can’t get it past 3856 bytes on my google calendar. I’ve been futzing with some file download stuff with fwrite and fread on the php pages to no avail.

Comment from dwc on

Is your calendar really large? I’m wondering if your wp_remote_fopen call is actually using cURL and timing out.

Comment from Benjamin on

No, I just started it. It has like 10 things on it. I’ve tried all the methods fopen, curl, get_file_contents, and buffered output. To contrast, another ics on another server is like 20k and downloads in its entirity. mine is like 4k

Comment from Benjamin on

I’m using the private ical basic and set it not to update as often and it seems to be working now. http://jewishmeetup.com/chicago/ical-events.phps However, the encoding of the &acir; apostrophe isn’t working, though utf_decode in the import php at least reduces the mess to a ? Google Calendar ics seems to be ISO-8859-1 and my wordpress site is UTF-8

Comment from Benjamin on

I know I’m posting a lot.. I’m thinking a lot though 🙂 So, if I want to highlight my repeating events separately, I changed to one repeating event

and added the second line
$events = ICalEvents::sort_by_key($events, ‘StartTime’);
$events = ICalEvents::sort_by_key($events, ‘rrule’); //sort by rrule

so that after it sorts by start time, it would sort them by rrule to concentrate them all together, but perhaps because they don’t all have rrule, this duplicated some events… hmm..

my goal is something like
Event: Mondays
Event: Tuesdays
Event: Monthly

Comment from dwc on


No problem – it’s interesting to see how you’re extending the plugin.

I’ve committed a couple of changes so far based on our discussion. The first is support for reloading calendars. The second is character set conversion support. Let me know if those work for you.

I don’t understand why the Google Calendar private URL seems to be working, while the public one isn’t. Very odd, but I’m glad there’s one that gives you the results you want.

For displaying two calendars and highlighting repeating events, you might be interested in writing a custom display plugin.

Comment from Benjamin on

cool diffs, thanks. I’m just happy that it’s working now, and beautifully with the merged calendars. (though there seems to be an issues with events that repeat daily or monthly while weekly works fine…. I’m looking into it later tonight)

Comment from Benjamin on

I added the ability to click a summary to show or hide a description. http://jewishmeetup.com/chicago/ical-events.phps This way I can have longer descriptions and it doesn’t clutter the page. It’s more a hack than a mod, but it works just fine in ie7 and firefox 2

Comment from Dom on

I am some what of a newbie, so any help is appreciated, even being pointed in the right direction with an example somewhere. But I am trying to use ical events and wondering if it is possible to use javascript to bring it into my homepage (index.html) (not wordpress) on right hand side listing all events for the next 30 days. Like I said, any help is greatly appreciated. Thanks

Comment from dwc on


It’s possible but it would require a bit of hacking. You could create a page using a custom WordPress template that calls only the ical-events plugin and then include that page using server-side includes or perhaps even AJAX.

It might be simpler to move your homepage into WordPress – you can use a page for the WordPress front page. If you’re concerned about load on the server, you can use wp-cache to reduce the cost of serving a page from WordPress.

Hope this helps!

Comment from Andy on

dwc = lifesaver. thanks for the plug-in.

Comment from mantra on

I can not get the updates in calendar to show on the site. A Cahe problem? How to fix it?
And how to get some extensions on the web page – as in date, place, repeat, past events etc?

Comment from dwc on


By default the plugin caches each calendar for 24 hours. See the FAQ for more.

You also can control the output using some of the options to the display_events function. The various options are described in the readme.

Comment from Jonathan Uhlmann on


Thank you a lot for your plugin! Is there a possabillity to have the Strings (like %B) in the different language? For example in german?

Thankx for your help!

Comment from Jonathan Uhlmann on

I got it!
When you use setlocale like this
setlocale (LC_ALL, ‘de_CH’);
it works.

I would like to make a feed (rss or atom) from a .ics file. Do you have planed to integrate this feature?

Comment from dwc on


Thanks for the tip about l10n!

I haven’t added real l10n support, but there aren’t many strings that need it in the plugin. (Most of them are error messages.)

As for making a feed, the plugin itself probably won’t get this feature. However, you can create one using a page template that calls the ical-events plugin, similar to how a custom display plugin calls it. If you’re interested, I’d love to have such a template provided as an example with the plugin (with full credit going to you, of course)!

Comment from Jay Wollmann on

Glad to see another techie using apple software!

Comment from Jonathan Uhlmann on


I’ve got another question: If I have an event who is today, it only shows the time. Is there a possabillity to render also a text?
instead of: “@ 19:30” it should display “Today @ 19:30”

Comment from dwc on


That isn’t possible out of the box. You could modify the format_date_range_part function to handle that.

Comment from Robert Spencer on

Hi dwc,

I just wanted to post to let anyone know that if they are putting CSS into the custom fields (before_description or similar) that they don’t need to worry about the quotes around classes etc, the plugin puts them there for you.

Also, I’m trying to create a custom date that uses a short form of the date for display but has an abbr tag with the full date… but if I put the html into the date format it is escaped and outputs literally and if I put it into before_date then it doesn’t have context. I want something along the lines of 14.07.07 and would prefer not to modify the format_date_range_part function if I could avoid it 🙂

Comment from Dave S. on

Great plugin. Worked like a charm from the moment I set it up. I am running into one problem though. I have events defined in my Google calendar that occur on the second Tuesday of every month. In my Google calendar view things are good, but when I take a look at them on my blog, they are showing up as though the event takes place every Tuesday of every month. Any idea why?

Comment from dwc on


Unfortunately some repeating event types aren’t supported currently. Where possible I’ve extended the parser, but it still has a few holes.

I’d appreciate help in adding support for events like the one you’re describing – if you’re interested, let me know.

Comment from Kretzschmar on

I want to use this great plugin on a german blog. The date is correctly localized (thanks Jonathan – set_locale …). BUT all events with german lings (äöü) aren’t shown correctly (Jörn Geburtstag instead of Jörns Geburtstag).
Is this a problem of the ical file of google calendar or are foreign languages not correctly decoded (or supported)?

Comment from Kretzschmar on

I couldn’t wait, so I made a first fix on my own. The problem is the parser (import.php). On utf_8 encoded blogs (the typical german encoding of WordPress) the summary needs to be decoded properly.

On line 83 I changed:
$event[$substate] = $match[1];

$event[$substate] = utf8_decode($match[1]);

I just need to check if there are other fields with lings (äöü). Right now this is a first fix that works here.

Comment from Kretzschmar on

Just downloaded your already fixed version you posted above. Next time I really should read better.
I made a hack, but you made it beautiful. Thanks.

I would like to group events (all events of one month) – e.g.:

Mo, 01.01.07: Swimming
Fr, 07.01.07: Cycling

Fr, 05.02.07: Hiking


Comment from dwc on


Grouping events by month is most easily achieved using a custom display plugin. It requires a bit more work on your part, but you get full control over how the events are displayed.

Comment from Kretzschmar on

Sorry, but I think this is really beyond my skills. Do you plan to support some more styling to the output in the future?

– only show date once if starting day end end day is same
– group month
– Show all events of same day

Comment from Free-Loops.com on

Hey on my WordPress site with that plugin the time is off how do i fix this? It doesn’t read from the windows clock like javascript does?

Thanks ahead of time
Mike Koenig

Comment from dwc on

Kretzschmar, not in the immediate future. The plugin is largely stable at this point. If someone provided a patch that didn’t affect existing functionality I would most likely add it, though.

Mike, your calendar is probably in a different time zone than your server. Check if you can set it in your calendar program.

Comment from Kretzschmar on

I wrote a widget for your excellent plugin. This is something in my scope. Right now it is only part of my own theme dkret2. I could make it work standalone and send you my changes if you want.

I had one problem though. I tried to load WordPress default date and time format (with get_option(‘date_format’)) to make it a bit more automatic but I failed because WordPress doesn’t use %. Maybe that is something you could add in the future. If no date or time format is set, use the default of WordPress.

AND PLEASE everybody having more knowledge: provide a patch as dwc suggested.

Comment from Andrew Kronemyer on

After a ridiculous amount of searching and sampling various event calendar plugins, this is literally the only one that has proven to be both robustly programmed and satisfactory for my purposes. Thank you for writing this excellent plugin!

Comment from Joe Hamilton on

My list of events are Art exhibitions that run for around a month each. I would like the events to appear on my site until the exhibition is over.
At the moment the events disappear after the first day of the exhibition.
Can anyone suggest a hack that would allow this.

Comment from carl on

Thanks a lot for providing this plugin! It’s really useful, and the only stable alternative I’ve found so far.

I’ve almost got it configured perfect for my needs, but I’m just not skilled enough for the last little part:

Right now I get it to display like this:

fri 2. nov 19:30 – 21:45: [eventname]

using the following code:

But I really want to get rid of the ending time, it just takes up place.
And ideally, want it to display devided into two lines. That leaves my perfect goal like this:

fri 2. nov
19:30(start time only): [eventname]

Would be great I could get some help on this one! Hopefully it’s just a little tweak of the arguments in the string?


Comment from carl on

sorry, the code didn’t show up corectly. here it is (without the php tags:)

setlocale(LC_ALL, ‘mylocale’);
ICalEvents::display_events(‘url=mycalendar.ics&limit=3&use_description=0&use_location=0&time_format=%H:%M&date_format=%a %e. %b&gmt_start=’ . time());

Comment from Mary-Ann Horley on

I notice on wp.org/extend that this plugin is only listed as compatible with 2.2, I’ve got it working on a few 2.3 installations so you might want to update that. Great plugin!

Comment from dwc on

@carl: That isn’t currently supported, but it would be possible to add new flags for using the start time and using the end time. For example, you could add a flag named use_start_time and another called use_end_time.

@Mary-Ann Horley: Thanks for the info! I’ve updated the compatibility statement, which will be live in the next release.

Comment from Nick Smith on

Hi, thanks for this plugin, definately the most useful I’ve found. One question, I’m using the code you posted at the top of this page, I’m trying to get this plugin to only display future events. Specifically, the section of code I’m using that I think will do this is “gmt_start=’ . time()”. When I display the feed you used in your example (http://www.ufl.edu/calendar/ufCalendar.ics) the first item it displays is “Fri Oct 12 6:45 PM: The Philosophy Department presents the “Necessity and Possibility” Conference” – which is a while ago. I’m wondering what kind of date format I need to pass the plugin, is the unix timestamp that time() returns OK? I guess it might be something wrong with the value my host’s server is returning. Otherwise I don’t really know what I’m doing wrong. Thanks for any help.

Comment from Daniel on

Hi, this looks like a plugin I would like, so i tried it. I use it in wordpress 2.3 togehter with KB Countdown Widget. It doesn’t seem to work, and I get this error:

“iCal Events: Could not fetch [http://www.google.com/calendar/ical/navet.kalender%40gmail.com/public/basic.ics]”

The calendar is fully available to all, so I don’t see how it can’t fetch it. Do you?


Comment from dwc on

@Nick Smith: gmt_start is the right parameter. For example:

ICalEvents::display_events('url=http://www.ufl.edu/calendar/ufCalendar.ics&gmt_start=' . time());

You can check your server’s time using date('r');

@Daniel: I’m not having any problems displaying events from that URL. It sounds like wp_remote_fopen isn’t working on your installation. You’ll need cURL support or allow_url_fopen on in PHP.

Comment from Benjamin on

I like using this plugin with the php code widget to insert the code. Also, I found a bug in my mod, that when displaying one feed, you need to add in the display_events paramaters that url2 = “” as a default

Pingback: Webmaster Forum

Comment from Christopher on

Great plugin, just what I was after.
Have managed to use options and tweak display to get a format I like, but I would like to display events from now to end of year but can’t get gmt_end to work.
What is the correct way / format to use gmt_end in a url?
Many thanks.

Comment from Christopher on

Possibly not good form in answering my own question…
In the cold light of day I figured it out:
mktime(0, 0, 0, 12, 31, date(“Y”))

Comment from Andrew Schmitt on

While a comment above indicates the plugin inserts quotes around class declarations automatically (http://dev.webadmin.ufl.edu/~dwc/2005/03/10/ical-events-plugin/#comment-4335) I can’t get this to happen in my install. As a result I am getting many errors with xhtml checking.

I’ve tried to escape out the quotes in the class declarations but that doesn’t work. I don’t expect the plugin to add them manually and may just hack the core files to get what I need but I would rather not. Any ideas?

Here’s how I call the code from the sidebar.

Upcoming Events

$queryString .= “&after=”;
$queryString .= “&before_date=”;
$queryString .= “&after_date=”;
$queryString .= “&use_summary=true”;
$queryString .= “&before_summary=”;
$queryString .= “&after_summary=”;
$queryString .= “&use_description=0”;
$queryString .= “&replace_newlines_with=”;
$queryString .= “&before_description= – “;
$queryString .= “&after_description=”;
$queryString .= “&use_location=0”;
$queryString .= “&before_location= (“;
$queryString .= “&after_location=)”;
$queryString .= “&use_url=0”;
$queryString .= “&gmt_start=”;
ICalEvents::display_events($queryString . time()); ?>


Comment from Thomas on

Trying this great plugin at the moment, but I’m struggling with localization. I want to have the names of the days in German and tried with “setlocale(LC_ALL, ‘de_CH’);” before the display_events…, but nothing happens. Ever tried that?

Comment from dwc on


I’ve heard reports that using setlocale like that works, but I’ve never done it myself.

Comment from Nat on


I’m pulling my calendar off of another website I manage, and there is a time difference between the two calendars of two hours — the new calendar uses ical-events and is two hours earlier than the original calendar. I suspect that this caused by my server, which is in Mountain Time (I am Eastern Time). However, I am managing both sites off of the same server, so I’m not sure what I should do. Is there a way I can shift my new calendar two hours forward?

Comment from batna on

Where is my template? where to add “ …

i have installation problem…help.

Comment from dave on

this is a great plugin that works around the horrid XML that Google Cal outputs. The standard WP rss widget is useless because of the Google Cal output, but this is perfect. My question is, can I add some before/after control for the timestamp? It seems that the timestamp gets wrapped inside the before/after for the date field. I’d like to put a linebreak between the date and timestamp and after the timestamp. Thanks!

Comment from dwc on


You could try adding the appropriate HTML markup to the date_format and time_format, though I’m not sure if that will work.

Otherwise, you can add your own tweaks to format_date_range and format_date_range_part to add a linebreak.

Comment from dave on

thanks for getting back to me quickly. i tried some stuff in both those spots already and it doesn’t seem to want to work with me.

Comment from Mark on

Just started to use the plug-in, and find it to be excellent for my needs.

I’m no coding expert, so need a little help. I would like to change the text colour of the date in my display. Is this possible.

Many Thanks Mark

Comment from Hussain on

How to send the ical event to a mail using PHP. I tried but it sent as an attachment. But i want to display the events in the mail. If i send the mail it should automatically added to my calendar events. Pls help me(Thanks in advance).

Comment from Mark on

I’ve sorted the formating of my date display, I found I could add a tag in the ical-events.php. add call it from the wordpress stylesheet

Cheers Mark

Comment from John_C on

Nat and kwirq –
I had the same problem with the time being offset. I added some code to ‘import_ical.php’ to add 2 hours to the time. (That happens to be the timezone difference between the webserver and the site I am working on.) I’m not sure if this is the correct place to adjust the time, but it seems to work.

in the icaldate_to_timestamp function:
look for “$H = substr($vdate, 9, 2);”

change it and add the following:
$H = substr($vdate, 9, 2) + 2; // JC 4/16/08 — added “+2” to hopefully adjust the server’s timezone to match mine.
if ($H > 23) { // $H is 24 or 25
if ($H > 24) { // if $H is 25 add a day
$d = $d + 1;
$H = $H -24; // $H will be either 0 or 1

A few lines later in the code, there is a comment that says “Problem here if server in different timezone”, but the code was never written to fix this problem. I don’t know PHP very well and I couldn’t find a way to access or change the the timezone for my web account. I also tried to use “date_default_timezone_set” function, but it didn’t work. I think it is because it is only available in PHP version 5.1.0 and up and I am probably using an earlier version. It seems like it would be EASY (for someone with a little more knowledge than me) to make the iCal timezone match the WordPress timezone.

Comment from trendysetgo on

If go into my google calendar, and put a link in the ‘what’ field. It get’s displayed as the html code, and not an actual link. I know someone above mentioned something about this, but in the description field, which i think is different than the ‘what’ field. would that be the summary?

Is there something i can do to change that?

Comment from dwc on

@trendysetgo: The iCalendar format supports a separate field for URLs, which Google Calendar doesn’t let you use.

You can modify the plugin for your needs by changing do_display_events to something like the following:

if ($use_summary and $event['Summary']) {
    $output .= $before_summary;
    $output .= '<a href="' . htmlentities($event['Summary']) . '" rel="nofollow">';
    $output .= htmlentities($event['Summary'], ENT_COMPAT, $charset);
    $output .= ''
    $output .= $after_summary;

Code is untested and any modifications you make won’t be supported, but hopefully this gives you an idea of how to make it work.

Comment from DeezJee on


I really do love your plugin, but I wonder if it’s possible to have events displayed the complete day. So even if the event is passed, but it’s still the day of the event it will be still visible?


Comment from Russ on

I’m using iCal events to display both future events and past events on my website (http://www.thexyzaffair.com). The problem is I’m limiting the “past events” display to 8 events, so it only shows the earliest 8 events. I want it to show the 8 most recently passed events.

Is this at all possible? How do I accomplish this? Do I need to change the structure of the loop? Thanks!

Comment from dwc on

@DeezJee: You should be able to calculate values for gmt_start and gmt_end that allow you to do that.

@Russ: A custom loop sounds like the easiest way to accomplish that.

Comment from Russ on

Awesome! One small problem… I have no idea how to create a custom loop to do that. Any resources you could point me to? Any hints? Thanks a million!

Comment from DeezJee on

Isn’t gmt_start and gmt_end not for limiting the events to be displayed?
I only want the events NOT be removed from the list before the day has finished. Something like an allday event but with the start time displayed

Comment from dwc on


How about a gmt_end that matches with 23:59:59 for the current day? That would keep events for today on the list until the day has finished. For example:

$gmt_end = gmmktime(23, 59, 59);

Comment from DeezJee on

Where should I place this code? Or do I have to replace the some code with this one?

Comment from dwc on

Pass it to your display_events call:

ICalEvents::display_events('url=http://www.ufl.edu/calendar/ufCalendar.ics&limit=8&gmt_end=' . gmmktime(23, 59, 59));

Comment from DeezJee on

This doesn’t work for me. When I try it I get a white page as a result.
I use this code:

ICalEvents::display_events_nourl(‘url=http://www.ufl.edu/calendar/ufCalendar.ics&limit=8&before_date=&after_date=: &before=&after=&date_format=%B %e, %Y&time_format=[%H:%M]&gmt_start=’ . time()’&gmt_end=’ . gmmktime(23, 59, 59));

Comment from DeezJee on

It also doesn’t work with this code:

ICalEvents::display_events(’url=http://www.ufl.edu/calendar/ufCalendar.ics&limit=8&before_date=&after_date=: &before=&after=&date_format=%B %e, %Y&time_format=[%H:%M]&gmt_start=’ . time()’&gmt_end=’ . gmmktime(23, 59, 59));

Comment from dwc on

How about this:

ICalEvents::display_events('url=http://www.ufl.edu/calendar/ufCalendar.ics&limit=8&gmt_start=' . mktime(0,0,0) . '&gmt_end=' . mktime(23,59,59));

This sets gmt_start at the very beginning of the day.

Comment from DeezJee on

This works, but now the events of today are listed at the bottom of the list.

Comment from DeezJee on

I think I solved the problem. Thanks for your help!

Comment from Jawker on


i can’t seem to delete the cache folder from my server.. any help?


Comment from Software on


i can’t seem to delete the cache folder from my server.. any help?


Comment from Teresa on

Hi – I am sorry but I seem to be a bit less experienced than most users. I am having trouble figuring out how to bring the Google calendar into the settings. The only option I saw was to download the calendar as zipped folder ICS folder, which I did :o) I also sucessfully installed the plugin (thanks!) I see it on my site, but just a warning that I have no calendar set – so my question is how do I make the two halves meet? :o)

Thank you!

Comment from dwc on


In Google Calendar, you can get the address for a calendar by going to Calendar Settings. The URL you want is under “Private Address” and should be the green “iCal” button.

Comment from Peter on

I’ve got a small problem with my blog that shoots out to my google cal. It reads the calendar just fine unless the day has more then one event. In that case it only reads the first one. Is the problem here or KB Countdown Widget or Google? Thanks

Comment from dwc on


Could you provide the code you’re using the display the calendar?

Comment from Peter on

One problem with that: I didn’t write any code. I’m using the KB Countdown Widget within wordpress which looks at the calendar using iCal Events Plugin. I’ll post the code if you know where the code would be.

Comment from dwc on


Can you tell me the URL of your Google Calendar then? I’ll test it out with the iCal Events plugin.

Comment from dwc on


I plugged that URL into the iCal Events plugin and got two events on November 25. Does that sound correct?

Comment from Peter on

Yes, their are two on that day. So the error isn’t here, but with Countdown Widget. Thanks for the help trouble shooting.

Comment from compmania15 on

“In Google Calendar, you can get the address for a calendar by going to Calendar Settings. The URL you want is under “Private Address” and should be the green “iCal” button.”

I can’t seem to locate this. Any Help?

Comment from dwc on

There should be a list of your calendars on the left. Click the arrow to bring up a menu, and choose “Calendar settings”.

Comment from David on

I’m trying to install the Ical event calender plug-in. I uploaded the ical-events.php and import_ical.php to the plug-ins folder (wp-content/plugins), and activated the plug-in, but that’s where I need help. According to the instructions I need to place this script:

<?php ICalEvents::display_events(‘url=http://www.ufl.edu/calendar/ufCalendar.ics&limit=3&gmt_start=’ . time()); ?>

…in the template. Exactly which template and where in the template.

Here is the link where I got my installation instructions:
ICal Events Calender

Here is the author’s site that created the plug-in:

Here is the particular page (calender/events) of the “TheTequilaMan.info” blog site I would like to have the calender in:

For now, I created a link to access the calender page.

I would be very helpful if someone can lend me a hand.

San Diego, CA

Comment from David on


I didn’t create new page template as you mentioned on your comment, not yet!

But, I did some hunting, and I found a plug-in that will run php scripting, it’s called “Exec-PHP” plug-in.

Here is the info for that particular plug-in if you’re interested:


Some how it won’t display TheTequilaMan calender, but will display the sample one that you have in this post

What am I doing wrong.

San Diego, CA

Comment from dwc on


The ICalEvents::display_events script contains a URL. The example points to a calendar here at the University of Florida.

You’ll need to update that to point to the iCalendar URL for your calendar. If you maintain your events in Google Calendar, for example, you can go to “Calendar Settings” and copy the URL from the “iCal” button.

Comment from David on


I don’t maintain my events in Google Calender. I actually use webCalender 1.2.0, and I got it from here:

And, I uploaded to the host and installed it. I can grant you access to the admin side of the webCalender, that if you want to do it.

Comment from Beegs on

I can only see 3 events on my calendar even though there are 4. The 4th event is 8 months away…is that an issue?

Comment from John Cullum on

I’d like to allow users to be able to share a calendar which will enable them to see what times I’m available during the day. While logged in, they can easily see what times are open then schedule an available time to meet me. It would be great if it published to an iCal RSS feed so anyone can subscribe to the data.

Comment from dwc on


You can add some custom code to your WordPress templates to check if a user is logged in and only display the calendar if so.

Comment from Laurent on

I have a timezone problem, events are displayed with the wrong timezone.
I checked with the debug mode that the event is read with the right start/end time but it is displayed as if it was GMT time instead of GMT-7. I checked that the calendar itself is correct set to GMT-7

For instance this event shows up as Monday 8/30 12:00 to 1:00 am, instead of Sunday 8/29 5 pm to 6 pm:
UID = [218tpmff5f3r3qlncvjim6c278@google.com], StartTime = [1283126400], EndTime = [1283130000], Untimed = [], Duration = [60], gmt_start = [1282239469], gmt_end = []


Comment from dwc on


I don’t believe that the plugin reads the timezone from the calendar itself, unfortunately. You may need to set the default timezone manually. For example:

This assumes that you’ve set the correct timezone in your WordPress settings. Let me know your results!

Comment from Laurent on

Hi Mark,
Thanks for the quick response. It fixed the problem, but I don’t understand why this problem doesn’t occur for everyone using the plugin. Also, why do I need to reset the default timezone after calling ICalEvents?

Comment from dwc on

Your server’s timezone doesn’t match the one used on your calendar. Other people probably have servers where the timezones match.

The plugin should probably just set the timezone from the calendar itself, so this may not be necessary in the future.

Comment from Jason on

I’m having the same issue but I don’t know where to paste the code you supplied above. Just anywhere in the ical-events/ical-events.php or somewhere specifically?

And do I change the ‘timecode_string’ at all or leave it alone? I would like it to display USA Pacific Time (GMT -8:00).

Thanks for any help. I’m pretty much a beginner at this. Sorry if I’m missing something obvious.

Comment from Laurent on

BTW, I have another quick question. I’d like to combine the events from 2 calendars.
If I add a “url2” argument to ICalEvents, can I simply merge the 2 list of events like this?

$events = ICalEvents::get_events($url, $gmt_start, $gmt_end, $limit);
$events .= ICalEvents::get_events($url2, $gmt_start, $gmt_end, $limit);

Comment from dwc on

You can do that, but you’ll need to sort the resulting array according to the event time. I think uasort would be your friend there.

Comment from Mary Ann Burcott on

“In Google Calendar, you can get the address for a calendar by going to Calendar Settings. The URL you want is under “Private Address” and should be the green “iCal” button.”

I can’t seem to locate this.

Mary Ann Burcott
CS Analyst Proxy Corp
“The shortest distance between two points is a LEAP OF FAITH.”

Comment from کرکره برقی | درب اتوماتیک on

Hi – I am sorry but I seem to be a bit less experienced than most users. I am having trouble figuring out how to bring the Google calendar into the settings. The only option I saw was to download the calendar as zipped folder ICS folder, which I did 😮 ) I also sucessfully installed the plugin (thanks!) I see it on my site, but just a warning that I have no calendar set – so my question is how do I make the two halves meet? 😮 )

Comment from Brian on

Hey Daniel,

a buddy just showed me your plugin on an old blog of his. It works great. As I have 3.1 installed I just wanted to know if it is supported?

If you still develop the plugin you should consider adding it to http://best-plugins-for-wordpress.com

A friend told me that people now really dig his gallery plugin.


Greetings from Germany


Comment from New Year Gifts on

I’m having the same issue but I don’t know where to paste the code you supplied above. Just anywhere in the ical-events/ical-events.php or somewhere specifically?

Comment from Jim on

Finally, I got it working. Great plugin. I’m also having trouble with the repeated parsings. But overall, I think it’s great.

Comment from Productos Institucionales on

“In Google Calendar, you can get the address for a calendar by going to Calendar Settings. The URL you want is under “Private Address” and should be the green “iCal” button.”

I can’t seem to locate this. Any Help?

Comment from geffsteve on

After a ridiculous amount of searching and sampling various event calendar plugins, this is literally the only one that has proven to be both robustly programmed and satisfactory for my purposes. Thank you for writing this excellent plugin!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.