About Me

I'm a Junior Computer Science student at Clarkson University in Potsdam, NY. I have a wonderful fiancée, Joelle, who I adore. We're getting married in July of next year and I'm very excited about it! My interests center around computer related topics with an emphasis on web technologies and networking. For more, see my About Me page.

21 June 2008 - 9:40pmGoogle Calendar Feed Parser

Update: I’ve added a screenshot of the plugin in action on a blog I administer.  You can view it here.

Google Calendar Feed Parser is a Wordpress Plugin designed to facilitate incorporating a Google Calendar XML feed into your WordPress blog.  I wrote this plugin after being unable to find an existing plugin to provide similar functionality.  I intend to keep this plugin up to date, compatible with the most recent releases of WordPress, as they occur.  If you have suggestions, comments, advice, etc. or you would like to help me develop the plugin, feel free to leave a comment and I’ll get back to you.  Any help is appreciated (especially since this is my first WordPress Plugin).  Please let me know if you have any timezone related issues, I had some odd problems getting the times to appear properly.

To install Google Calendar Feed Parser:

  1. Download the zip archive and extract it to the wp-content/plugins directory.
  2. Go to the “Plugins” page in the WordPress Admin interface and click the “Activate” link for the Google Calendar Feed Parser.

To configure Google Calendar Feed Parser:

  1. Go to the “Settings” page in the WordPress Admin interface and click the link for the “Google Calendar” page.
  2. Set the URL for the calendar feed and other settings as desired (see below for full explanation of all options).

Options:

  1. Feed URL: This is the URL of the feed you wish to incorporate in your blog.  It should be of the form:

    http://www.google.com/calendar/feeds/userID/public/full?param=value&param=value…

    • For a listing of available parameters, see the Google Calendar API documentation. I found the following query string to provide desirable results:

      ?orderby=starttime&sortorder=ascending&futureevents=true&singleevents=true

    • Note that the max-results parameter should not be specified here as it will be handled by the setting below.
  2. Static URL: Use this option if you want to have each event link to a single URL (e.g. have each event link to a page where you’ve embedded your Google Calendar).  If you leave this set to “No”, the plugin will use the link provided by the feed for each individual event.
  3. Max Results: Use this to set the maximum number of events to retrieve and display from the calendar.  If left blank, the plugin’s default is 4.

To Use Google Calendar Feed Parser:

  1. Include a call to the function <em>gcal_parse_feed()</em> at the spot where you want the feed to appear.  I use the feed in my sidebar but you could use the feed wherever you want.
  2. Include style rules in your template’s stylesheet to customize the look of the feed.  A single event outputted from the plugin would be of the form:

    <div id=”events”> <div class=”event”> <h3><a href=”http://some-link-here”>Event Title</a></h3> <p id=”event_time”>July 12, 2009 from 9:00pm to 10:00pm</p> </div> …more events here… </div>

Donations:

If you like this plugin, please consider donating.


Changelog:

Version 0.1 (first):

  • Ability to set feed URL.
  • Choice of whether to use event URL from feed or static URL for each event.
  • Ability to set max-results parameter.

Future Functionality:

  • Ability to customize query string from the Admin interface in WordPress.

13 Comments | Tags: COSI, General, Technology

Comments:

  1. Would love to see this for expression engine!

  2. mocona says;
    27 Jun 2008 - 10:37pm |

    Do you have a screen shot what is it like in wordpress ? specially in sidebar ?

  3. Justin says;
    27 Jun 2008 - 11:53pm |

    I’ve posted a screenshot here.

    Please let me know what you think of the plugin. Thanks!

  4. Dave says;
    30 Jun 2008 - 12:58pm |

    Great idea for a plugin. Unfortunately, I’m getting a 404 Error on my page when I tried to include it. I thought maybe my calendar wasn’t shared properly, so I used a public one (http://www.google.com/calendar/feeds/up9ba31v77o3bvjfoh1soeqapk%40group.calendar.google.com/public/basic), but that didn’t work either. I have the static option set to “No” and the max events set to 4. How did I go wrong? Thanks.

  5. Emily says;
    10 Jul 2008 - 12:57am |

    I’m having the exact same problem as the Dave. Any ideas what the problem is. I’d REALLY like to use this plugin and would gladly donate if you could help me figure out what I’m doing wrong.

    Here’s what I have as my feed URL:

    http://www.google.com/calendar/feeds/deni%40denibonet.com/public/basic?orderby=starttime&sortorder=ascending&futureevents=true&singleevents=true

    The other two options are just set to the default settings.

    I couldn’t find any url that had “full” in it anywhere, so maybe I’m using the wrong one? I tried substituting “basic” for “full” but that didn’t help. I’m not getting a 404 error like the commenter mentioned above, but when it gets to the part of the sidebar with the function call, it just stops. It doesn’t show anything and it doesn’t display anything that’s underneath the function. Basically, it gets to that code and the sidebar just goes blank.

    Any help would be greatly appreciated.

  6. Justin says;
    10 Jul 2008 - 7:39am |

    Hey everyone,

    Thanks for the comments. I’m not sure what the issue is, but I will look at it as soon as I have some free time. I looked at Dave’s issue a bit and couldn’t really come up with an explanation as to why he’s getting a 404 error.

    Like I said, as soon as I have some time I’ll look into it. In the meantime, if either of you figure it out, let me know.

    Thanks,
    Justin

  7. i think that the errors are showing up with the date portion of the feed. $start and $end are looking for missing child nodes… I got this to work for http://www.busproject.org with a few small tweaks. email me if you need help.

  8. [...] and if you’re interested in the upcoming events widget, check out A Blog by Justin, as he’s the chap behind it. Very nice it is too. « Placebo - [...]

  9. Hi!
    Just trying to get this to work. My server disables the allow_url_fopen value which causes a file_get_contents not allowed error when I use your parser. I looked at the host’s wiki (wiki.dreamhost.com/allow_url_fopen). I then used their recommended curl replacement (wiki.dreamhost.com/CURL). Now I’m getting this fun little warning:

    gcal_parse_feed() [function.gcal-parse-feed]: Node no longer exists in /home/.sarge/prodaea/etherealnation.net/wp_providence/wp-content/plugins/google-calendar-feed-parser/gcalparse.php on line 128

    Any thoughts would be appreciated.

  10. nevermind, the new curl code worked fine once I changed /basic to /full in my gcal url. THANKS I AM REALLY LOVING THE PLUGIN. You can see it in prototype use at http://www.etherealnation.net/wp_providence

  11. Jasmine says;
    17 Aug 2008 - 3:53pm |

    When I try and activate, I get this error:

    Parse error: parse error, unexpected T_OBJECT_OPERATOR in …/wp-content/plugins/gcalparse.php on line 106

    What am I doing wrong?
    Thanks

  12. Hi!

    I really like this plugin. Just have a quick question for you. Is it possible to only get the DATE but NOT the time? Because sometimes the time isn’t relevant and I just want people to see what day an event is.
    Thanks

  13. Getting the same activation error as Jasmine. I am in WP version 2.6.

Add a Comment