iCal Events Plugin
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.
March 23rd, 2005 at 2:38 pm
Groovy tunes! Thank you!
October 27th, 2005 at 3:49 am
Excellent plugin, thanks.
November 1st, 2005 at 3:59 pm
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?
November 1st, 2005 at 4:13 pm
Josh,
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.)
November 7th, 2005 at 3:22 pm
Is there any way to display an event’s location and comments?
November 8th, 2005 at 1:49 am
Jeremiah,
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.)
January 16th, 2006 at 4:13 pm
Got this stuff while using the script for some days:
Warning: mktime(): Windows does not support negative values for this function in ..\wp-content\plugins\ical\import_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
January 25th, 2006 at 11:07 am
hmm, can’t get it to work thus far, all I’m getting is a blank template (using a custom template with the php tag pasted in).
I’m publishing from iCal to .Mac (don’t have webDAV access) and then pasting the url in as:
http://ical.mac.com/rogerherbert/test (which is iCal’s suggestion)
or
http://ical.mac.com/WebObjects/iCal.woa/wa/Download/test.ics?u=rogerherbert&n=test.ics
which is from the download link on the ical page from the first link.
January 25th, 2006 at 11:08 am
btw, the example URL given in the readme DID work! Is it perhaps something to do with .Mac?
January 27th, 2006 at 6:12 am
I have it working now!
the url I eventually used was
http://homepage.mac.com/rogerherbert/.calendars/test.ics
which I got from the .Mac page’s ’subscribe’ button, and replaced the webcal:// prefix with http://
March 24th, 2006 at 1:17 am
[...] iCal Events is a plugin that displays events from an iCal source. [...]
April 14th, 2006 at 8:02 am
[...] At the moment, I’m trying out the iCal Events Plugin. [...]
April 15th, 2006 at 5:23 pm
[...] Para ello, he usado el plugin iCal Events. Este plugin nos permite indicarle una url con el fichero .ics, el plugin se lo baja (cacheandolo para aumentar la velocidad y ahorrar peticiones a Google), lo parsea y genera el código html necesario. Para parsear el iCal se basa en la libreria “import_ical.php” del proyecto WebCalendar. En esta página del plugin encontrareis todo lo necsario par echarlo a andar. Yo estoy usando la versión 1.5. [...]
April 16th, 2006 at 6:52 am
[...] iCal Events Integración de Wordpress con estandard iCal. Util para integrar Google Calendar. [...]
April 16th, 2006 at 6:04 pm
I’ve got it working at http://www.officetally.com/?page_id=65 for future events, and http://www.officetally.com/?page_id=66 for past events.
I used to have to manually move future events to the past events page, but now I won’t have to!
Thanks for a fantastic plugin!
tanster
P.S. One question: would it be possible to support iCal’s URL field?
April 17th, 2006 at 1:00 am
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
April 19th, 2006 at 3:35 am
[...] Update: I’ve added a simple block on the bottom of this site listing the upcoming London 2.0 events using dwc’s iCal WordPress plugin. There is also a specific category and RSS feed for all London 2.0 meet-up information. [...]
April 20th, 2006 at 4:32 am
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?
Sokrates_d
April 20th, 2006 at 4:54 am
oops - yes I was being dim - forgot “url=” in source URL.
Sorry
April 26th, 2006 at 2:29 pm
Hi,
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?
April 27th, 2006 at 9:36 am
kwirq,
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.
May 4th, 2006 at 9:06 am
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;
}
May 5th, 2006 at 1:47 pm
Pete,
I’ve committed a fix for this to trunk. Please let me know if it works for you.
May 8th, 2006 at 3:45 am
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..
Cheers,
Pete
May 8th, 2006 at 11:51 am
Thanks, Pete. Applied to trunk as revision 6002.
May 20th, 2006 at 6:51 pm
Is there a way to display the time the events ends? Seems I can only get the starting time.
May 21st, 2006 at 11:05 am
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?
May 21st, 2006 at 6:02 pm
Sent.
May 29th, 2006 at 2:58 pm
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:
http://blog.firetree.net/2005/07/18/eventcalendar-30/
http://garrickvanburen.com/wordpress-plugins/wpical/
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?
June 15th, 2006 at 5:42 am
Got my mail?
June 25th, 2006 at 8:16 pm
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?
June 25th, 2006 at 11:33 pm
Conrad,
It sounds like there is a problem in your
display_eventscall. Try this:<?php ICalEvents::display_events('url=http://www.epiphanyeyc.com/phpicalendar/calendars/EYC%20Events.ics&limit=3&gmt_start=' . time()); ?>June 26th, 2006 at 1:38 pm
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.
June 26th, 2006 at 2:40 pm
Conrad,
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()); ?>June 26th, 2006 at 6:48 pm
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?
June 26th, 2006 at 7:36 pm
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.
June 26th, 2006 at 8:07 pm
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.
June 26th, 2006 at 9:25 pm
Hey
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.
June 26th, 2006 at 10:15 pm
Conrad,
Thanks for the info. I’ll try to take a closer look soon.
July 5th, 2006 at 6:57 am
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.
Thanks.
July 5th, 2006 at 9:13 am
matt,
There’s no built-in way to do this currently. I’d suggest that you use
ICalEvents::get_eventsto write a custom display function. You can put it in your own plugin:<?php
/*
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;
}
?>
July 6th, 2006 at 11:05 am
thank you for the information. will do.
July 7th, 2006 at 4:23 pm
How do I display displays from the current day, and not just from the current time forward?
July 8th, 2006 at 1:48 pm
Farhan,
Try the following parameters for
gmt_startandgmt_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));
August 19th, 2006 at 5:11 pm
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!
August 20th, 2006 at 1:04 pm
wes,
I’ve committed support for cURL via the url-cache plugin.
I’d appreciate it if you could test it out by installing url-cache and then downloading the “in-development version” of ical-events.
August 20th, 2006 at 2:13 pm
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.
August 20th, 2006 at 2:34 pm
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…
http://www.twentyeight19.org/calendar/
obviously, I’m still working on the site though, so cut me some slack
August 20th, 2006 at 2:50 pm
wes,
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).
August 28th, 2006 at 3:07 am
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!
August 28th, 2006 at 5:15 pm
emeff,
For that type of situation I recommend using the
ICalEvents::get_eventsfunction. 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!
September 12th, 2006 at 12:03 am
Seems not working any more after new updates. New version available yet?
September 12th, 2006 at 1:25 am
Eric,
Are you receiving an error message?
Also, are you using the url-cache plugin?
December 1st, 2006 at 7:07 pm
[...] The closest for the sidebar publishing was the iCal-events plug-in for WordPress, which could use the iCal data format published by gCalendar. What’s nice is it bad built in caching scheme, so it was not hitting gCalendar for every page load. It had the ability to sort future and past events differently, although I think that an events past calendar should list them in order with the most recent, and then receding in time (this plugin listed the oldest, and moved forward). I thought some simple hacking of the loop controls might get me there, but I only succeeded in making rivers PHP errors. [...]
January 9th, 2007 at 4:15 pm
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?
Thanks.
January 9th, 2007 at 6:12 pm
Mark,
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.
February 2nd, 2007 at 12:37 am
[...] That still wasn’t idea, but I read the comments of that blog entry to find that there was a WordPress iCal parser! It was easily to grab and install, but it only showed events that had already passed. So I hacked [...]
February 28th, 2007 at 2:09 am
Nice plugins, thanks!
April 8th, 2007 at 12:32 am
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.
April 9th, 2007 at 4:25 pm
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?
April 9th, 2007 at 4:56 pm
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!
April 12th, 2007 at 11:11 am
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!
April 12th, 2007 at 2:38 pm
justine,
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()); ?>April 15th, 2007 at 8:20 am
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) {
to
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
62-62
if (! isset($r['link_description'])) $r['link_description'] = true;
if (! isset($r['link_text'])) $r['link_text'] = ‘Link’;
66
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']);
74
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) {
106
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
April 15th, 2007 at 8:46 am
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']));
}
April 15th, 2007 at 9:56 am
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
April 15th, 2007 at 11:19 am
Benjamin,
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?
April 15th, 2007 at 11:28 am
just to be sure, i sent some patch code earlier and i’m not sure it posted, maybe caught as spam?
April 15th, 2007 at 11:32 am
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
April 15th, 2007 at 12:18 pm
Benjamin,
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.phpfile. In this file you could write amytheme_bbcode_linksfunction that replaces the appropriate patterns with HTML links and then wrap yourICalEvents::display_eventscall:echo mytheme_bbcode_links(ICalEvents::display_events('url=...&echo=false'));April 15th, 2007 at 1:45 pm
Without creating an admin page, I thought I could check something like this
if ($_GET['ical'] == ‘reload’ && !empty($_COOKIE[USER_COOKIE]) &&
wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true))
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…
April 16th, 2007 at 3:05 pm
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.
April 16th, 2007 at 4:58 pm
Is your calendar really large? I’m wondering if your
wp_remote_fopencall is actually using cURL and timing out.April 16th, 2007 at 6:14 pm
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
April 16th, 2007 at 9:41 pm
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
April 16th, 2007 at 10:18 pm
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
define(’ICAL_EVENTS_MAX_REPEATS’, ‘1′);
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
Event1
Event2
Event3
etc.
April 17th, 2007 at 10:28 am
fwiw, I added a function display_two_events that merges two icalendars http://jewishmeetup.com/chicago/ical-events.phps
April 17th, 2007 at 10:44 am
Benjamin,
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.
April 17th, 2007 at 1:24 pm
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)
April 19th, 2007 at 3:39 pm
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
April 24th, 2007 at 8:51 am
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
-Dom
April 25th, 2007 at 1:16 am
Dom,
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!
April 26th, 2007 at 11:37 am
[...] thanks to dwc and his iCal wordpress plug-in. The UF Student Financial Affairs calendar is now dynamically driven. « WORDCHASM [...]
April 26th, 2007 at 12:35 pm
dwc = lifesaver. thanks for the plug-in.
May 12th, 2007 at 8:26 am
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?
May 13th, 2007 at 12:35 pm
[...] iCal Events: zum Anzeigen von iCal Ereignissen vorgestellt von stohl.de [...]
May 14th, 2007 at 2:45 pm
mantra,
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_eventsfunction. The various options are described in the readme.May 29th, 2007 at 3:32 pm
Hi
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!
May 30th, 2007 at 7:15 am
I got it!
When you use setlocale like this
[code]
setlocale (LC_ALL, ‘de_CH’);
ICalEvents::display_events…..
[/code]
it works.
I would like to make a feed (rss or atom) from a .ics file. Do you have planed to integrate this feature?
May 30th, 2007 at 10:19 am
Jonathan,
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)!
June 6th, 2007 at 5:25 am
[...] Kalender wurde über das Plugin ICal Events realisiert. Darüber kann ich aus verschiedenen Kalendern, die einen ICal-Feed zur [...]
June 15th, 2007 at 12:30 pm
Glad to see another techie using apple software!
June 20th, 2007 at 3:41 am
Hi
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?
Example:
instead of: “@ 19:30″ it should display “Today @ 19:30″
June 20th, 2007 at 11:25 am
Jonathan,
That isn’t possible out of the box. You could modify the
format_date_range_partfunction to handle that.July 16th, 2007 at 12:10 pm
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_partfunction if I could avoid itAugust 29th, 2007 at 3:33 pm
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?
August 29th, 2007 at 6:49 pm
Dave,
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.
September 2nd, 2007 at 6:11 pm
[...] iCal Events Plugin for Wordpress [...]
September 14th, 2007 at 10:17 am
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)?
September 14th, 2007 at 10:44 am
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];
to:
$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.
September 14th, 2007 at 2:21 pm
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.:
January:
Mo, 01.01.07: Swimming
Fr, 07.01.07: Cycling
Febuary:
Fr, 05.02.07: Hiking
etc.
September 15th, 2007 at 1:09 am
Kretzschmar,
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.
September 15th, 2007 at 8:34 am
Sorry, but I think this is really beyond my skills. Do you plan to support some more styling to the output in the future?
E.G.
- only show date once if starting day end end day is same
- group month
- Show all events of same day
September 15th, 2007 at 6:13 pm
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
September 16th, 2007 at 1:17 pm
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.
September 17th, 2007 at 1:21 pm
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.
September 21st, 2007 at 1:41 pm
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!
September 30th, 2007 at 3:06 pm
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.
thanks!
October 29th, 2007 at 12:53 am
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?
regards
Carl
October 29th, 2007 at 1:00 am
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());
November 2nd, 2007 at 7:25 am
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!
November 6th, 2007 at 7:27 pm
@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_timeand another calleduse_end_time.@Mary-Ann Horley: Thanks for the info! I’ve updated the compatibility statement, which will be live in the next release.
November 12th, 2007 at 2:31 pm
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.
November 14th, 2007 at 11:12 am
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?
Thanks!
November 14th, 2007 at 1:32 pm
@Nick Smith:
gmt_startis 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_fopenisn’t working on your installation. You’ll need cURL support orallow_url_fopenon in PHP.November 14th, 2007 at 6:49 pm
[...] iCal Events: zum Anzeigen von iCal Ereignissen vorgestellt von stohl.de [...]
November 15th, 2007 at 1:16 am
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
November 20th, 2007 at 1:09 pm
[...] http://dev.webadmin.ufl.edu/~dwc/2005/03/10/ical-events-plugin/ [...]
January 2nd, 2008 at 7:17 pm
[...] proyecto: iCal Events te permite mostrar una lista de eventos utilizando como fuente ical. Eso esta chulo. Ademas como en [...]
January 9th, 2008 at 5:27 pm
WordPress Plugins: Inhalte erstellen, bearbeiten,anzeigen…
Dies ist ein Teil der WordPress Plugin Serie. Weitere Teile findest Du unter (wird später erweitert). Die Funktionsweise der Plugins wird nur knapp erläutert, damit man sich schnell einen Überblick un……
January 10th, 2008 at 8:35 pm
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.
January 11th, 2008 at 10:13 am
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”))
January 14th, 2008 at 9:57 am
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()); ?>
`
January 31st, 2008 at 5:16 am
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?
January 31st, 2008 at 11:09 am
Thomas,
I’ve heard reports that using
setlocalelike that works, but I’ve never done it myself.February 18th, 2008 at 5:09 pm
Hi,
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?
February 18th, 2008 at 11:02 pm
Where is my template? where to add “ …
i have installation problem…help.
February 19th, 2008 at 1:26 pm
@Nat: You could try adjusting the timezone using the PHP_TZ environment variable. I’ve never tried this, but it’s worth a shot.
@batna: Please refer to the FAQ for installation help.
March 11th, 2008 at 1:32 pm
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!
March 11th, 2008 at 6:38 pm
dave,
You could try adding the appropriate HTML markup to the
date_formatandtime_format, though I’m not sure if that will work.Otherwise, you can add your own tweaks to
format_date_rangeandformat_date_range_partto add a linebreak.March 11th, 2008 at 7:30 pm
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.
April 11th, 2008 at 4:18 am
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
April 11th, 2008 at 5:11 am
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).
April 11th, 2008 at 3:23 pm
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
April 21st, 2008 at 1:17 pm
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.
April 23rd, 2008 at 4:23 pm
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?
April 24th, 2008 at 11:30 am
@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_eventsto 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.
May 2nd, 2008 at 9:25 am
Hello,
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?
Thanks!
May 12th, 2008 at 2:35 pm
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!
May 12th, 2008 at 3:33 pm
@DeezJee: You should be able to calculate values for
gmt_startandgmt_endthat allow you to do that.@Russ: A custom loop sounds like the easiest way to accomplish that.
May 12th, 2008 at 3:46 pm
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!
May 12th, 2008 at 4:28 pm
Russ,
You can write a simple plugin wrapper. Use the code in
do_display_eventsas an example.May 14th, 2008 at 3:03 pm
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
May 14th, 2008 at 6:02 pm
DeezJee,
How about a
gmt_endthat 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);May 16th, 2008 at 10:26 am
Where should I place this code? Or do I have to replace the some code with this one?
May 16th, 2008 at 10:33 am
Pass it to your
display_eventscall:ICalEvents::display_events('url=http://www.ufl.edu/calendar/ufCalendar.ics&limit=8&gmt_end=' . gmmktime(23, 59, 59));