21 June 2008 - 9:40pmGoogle Calendar Feed Parser

, , , , ,

Update: Version 0.2 was released today (4/19/2009) which allows configuration of a timezone offset that can be customized to force start and end times from the XML feed to be displayed in the desired timezone (see documentation of the option below).

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).


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


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


    • 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.
  4. Timezone Offset: Change this value only if you are having issues with times from the feed displaying correctly. The value supplied in this field is a number of seconds added directly to both the start time and the end time for each event. The default for this value, if left blank, is 7200 seconds. Note: In a future release of the plugin, this option will be replaced with a more comprehensive timezone customization feature.

To Use Google Calendar Feed Parser:

  1. Include a call to the function gcal_parse_feed() 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>


If you like this plugin, please consider donating.


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.

90 Comments | Categories: COSI, General, Technology


  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:


    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.


  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?

  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.

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

  14. Great plugin! Wish I would have found it before I spent several hours on a PHP/namespace wild goose chase… :-) At least I have enough XML-parsing knowledge now to be able to customize the output a little.

    I agree that it would be helpful not to show times, either across the board or per a set of rules — like, if something goes from 2am Monday to 2am Tuesday, like some of mine seem to be.

    Also, the timezones are showing one hour off for me, but that could have to do with Daylight Savings Time being in effect.

    Even so, this is exactly what I needed! Thanks for taking the time to publish this plugin.

  15. Activation error like Jasmine and Jess. Perhaps it’s something with WP 2.6?

    Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/covchurc/public_html/wp-content/plugins/google-calendar-feed-parser/gcalparse.php on line 106

  16. Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /hermes/bosweb/web001/b15/ipw.thegoose/public_html/homepage/wordpress/wp-content/plugins/google-calendar-feed-parser/gcalparse.php on line 106

    this on an ipower.com server

  17. Just a quick not to tell you that this plugin _does_ work with WordPress 2.6, the only thing I had to adjust was replacing “basic” with “full” for the xml feed. Also, I used your recommended “?orderby=starttime&sortorder=ascending&futureevents=true&singleevents=true” extension, so, to clarify for others, my xml feed is now similar to:


    Hope that helps other people here. Thanks for a great plugin, I’m also going to write a basic tutorial on how to hack your code a little bit to get it to work with a lightbox on my website, if you’re interested in that, get in touch! Thanks once again! Great work.

  18. As a follow-up, I’ve got a few things you might like to add to your plugin after reading the Google API it wouldn’t appear to be too difficult…I’d hapilly help if you like to have some sort of collaborative effort, get in touch. Anyway, here’s the suggestions:

    * Having a link to the comments feed for each event
    * Having an option in the admin to adjust the CSS class of the event link produced by the plugin (which will help integrate with lightbox/multibox plugins
    * Having an option to adjust the rel= for each link (again to help integrate with other plugins)
    * Having a way for the backend part of the plugin to validate the link provided is a relevant xml feed link
    * Options to create the “end” of the feed automatically, i.e. be able to select the query parameters without hardcoding them into the feed

    Lots of possible ideas for this! I hope you find the time soon to get to work on it again, and, like I said, I’d hapilly help.

  19. @Jasmine & Merrill – I had the same problem. It’s because you need to use PHP5. I upgraded my host’s version of PHP from PHP4 to PHP5 and it now works!

  20. @Richard Tape – Thanks for your post. I was able to make this plugin work due to your advice!

  21. I’m getting the same error as jasmin, also using wp 2.6 … am not able to upgrade my hosts version of PHP … is there any other way around this as this plugin would be perfect for the project I have in mind?

    Any help is much apreciated!

  22. Same problem for me while trying to install it. Tested on 2 different websites, on 2 different hosts. I always get :

    Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /path/to/my/website/wp-content/plugins/google-calendar-feed-parser/gcalparse.php on line 106

  23. drew says;
    09 Mar 2009 - 10:46am |

    for those who have gotten this to work, where in your code did you place the gcal_parse_feed function call? i didnt get an error installing the plugin, but when i include that function call anywhere in my sidebar.php file, the calendar does not display on the page and the bottom of my theme is messed up.

  24. Justin says;
    09 Mar 2009 - 11:07am |


    You should be able to place the function wherever you want the events to be displayed. The code is very simple and pretty much just spits out some html wherever you put the function call. Try viewing the source of your page (Ctrl-U in Firefox) and see if the html is in there where it belongs. If it is and still isn’t being displayed, you could have some CSS rules that are causing it to not be displayed properly.

    Let us know how it goes and thanks for checking out my plugin!


  25. thanks for the help! i dont think i have any css rules blocking it as i am using the default theme, and did not modify the css. i placed the code in an li right below the get_search_form in sidebar.php. I included the url if you want to check it out. it looks like the source shows the beginning but then there is nothing after that. thanks!

  26. Justin says;
    09 Mar 2009 - 11:31am |

    It looks like something must be happening that’s causing that function to not work right and then stopping the rest of the page from loading. Off the top of my head I’m not really sure what the issue would be (I use this on another website I manage with the latest WordPress and it works great). The only thing I can think is that the function is throwing an error that’s not being displayed… that would happen if PHP is set not to display errors. You can enable errors in your script with a function call (search google for php show errors or something), if you get that working and it spits out an error, let me know what it is. That could help us figure out what’s going on.

    An error is the only reason I can think of that the rest of the page would quit loading…

  27. Justin says;
    09 Mar 2009 - 11:32am |

    Also, make certain that the calendar feed url that you’re using is valid and accessible by the general public. If that url isn’t working, that would cause the script to fail (more robust error checking in my code would help, I just never have had the time to continue work on it).

  28. I linked to a document that contains the php errors. Thank you so much for help!

  29. i think the feed is valid, i was able to subscribe to it through google reader, even after adding the parameters you specified up top

  30. Justin says;
    09 Mar 2009 - 12:19pm |

    Looking at the document, the first warning is the root of the problem: “Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration”. That means the the string that’s supposed to contain the contents of your feed’s URL ends up being empty and that causes the XML parser (SimpleXML) to throw a fatal error: “Fatal error: Uncaught exception ‘Exception’ with message ‘String could not be parsed as XML”. My code should catch that exception and display a message so that it doesn’t break the rest of the page… I’ll be adding it to my list of to-dos.

    I don’t know of a workaround you can use… my feeling is that if your web host has disabled URL access in that fashion, they’ve probably disabled it for all other methods as well, but I’m not sure. You could try contacting them and seeing if they can help you find a way to make it work, or you could try a few other methods for getting a URL in PHP. There are come curl functions for PHP that may work, you could also try executing a regular bash command from inside the PHP script (probably using curl to get the url), and I know there are some http_ methods available in PHP as well. I would recommend building a test script that just attempts to go get a URL and then spit its contents back out.

    If you find a function that works (keep in mind that the contents must be stored in a string), you should just be able to substitute that function call in place of “file_get_contents()” in the gcalparse.php file.

    Hope that helps you a little bit. Sorry I can’t be of much more specific help… it’s hard to troubleshoot problems like these because of the variations in configurations with hosting services. Let me know how it works out for you.


  31. Drew says;
    09 Mar 2009 - 12:46pm |

    No problem, I will check it out and let you know how it goes!

  32. Drew says;
    09 Mar 2009 - 3:21pm |

    I replaced “$xmlstr = file_get_contents($feed_url);” with:

    $ch = curl_init();
    $timeout = 5; // set to zero for no timeout
    curl_setopt ($ch, CURLOPT_URL, $feed_url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $xmlstr = curl_exec($ch);

    seems to have been a sufficient fix, thanks again for helping me out!

  33. Justin says;
    09 Mar 2009 - 4:58pm |


    Glad you got it working properly. In a future version of this, I might make an option to use curl or file_get_contents for people in a case similar to yours. I see it in action on your site, I hope it works well for you. If you have any ideas for future improvements, let me know.


  34. Hi Justin,

    Just had a small issue, if an end time and a start time aren’t set for an event, the script throws a fatal error at line 115.. Anyhow, I added some @’s to suppress warnings and a little checking for start/end times

    if(@$gd->when->attributes()->startTime) {
    $start = date(“l, F j \\f\\r\o\m g:ia”, strtotime(@$gd->when->attributes()->startTime) + 7200);
    } else {
    $start = “”;
    if (@$gd->when->attributes()->endTime) {
    $end = date(“g:ia”, strtotime(@$gd->when->attributes()->endTime) + 7200);
    } else {
    $end = “”;
    if ($end == “” && $start == “”) {
    echo “”;
    } elseif ($end != “”) {
    echo “Ends on $end”;
    } elseif ($start != “”) {
    echo “Starts on $start”;
    } else {
    echo “$start to $end”;

  35. I should have read the other comments first, doh, hehe

  36. I seem to be having an issue with time zones. I have my main account set to -6 GMT but the specific calendar I am working with is set to +-0 GMT as we are using UTC on the site. When I look at my gCal embedded on the site here: http://www.spacevidcast.com/calendar the events show up at the proper time in UTC. However when I look at the sidebar with the events parsed in this plugin it appears to be grabbing the times in -6 rather than 0.

    I tried adding ctz=europe/london and ctz=utc to the URL but neither seemed to change the time for the plugin.

    Any ideas on how I can make it so that the time zone is always UTC?

    And a quick feature request, I would *LOVE* it if the plugin could look at the users local time and figure out the time the event would be for them somehow. So rather than showing UTC and making them do the math, have the plugin display the event on the day and time that it would actually happen for them. No idea how hard that is, but it sure would be cool!

  37. Justin says;
    19 Apr 2009 - 1:42am |


    I’m glad you like the plugin and I apologize for the issues you seem to be encountering. Unfortunately, the timezone stuff was the part of the plugin I had trouble with when I wrote it. For the time being (until I have time to do some bug fixing and make some improvements), find $start and $end in the gcalparse.php plugin file (should be line 115 or so) and notice the values being added at the end of those lines (currently 7200). Modifying those values will mess with the timezone that the data gets displayed in and if you play with them enough you should be able to get them set to what you need. Unfortunately, when daylight savings time changes, you’ll have to manually update those values to reflect the hour time difference.

    I think I may take some time right now to make that value configurable from the admin interface, which would allow you to update it without messing with the code. If I can get that working, you should see opportunity for updating the plugin.

    Let me know if you have any other questions. I hope I helped a little bit. I hope you find the plugin to be useful enough to keep using.


  38. Justin says;
    19 Apr 2009 - 3:03am |

    I just added the feature I mentioned in my last comment. The plugin now gives the user the ability to directly edit the offset added to the start and end times of each post as detailed here and here. If you have version 0.1 installed you should be prompted to upgrade to 0.2 from the plugins section in the admin interface, otherwise you can download 0.2 from here.

  39. Yeah, saw the update, downloaded and installed that, working *great*! This was almost exactly what we were looking for in the original design, you have made an awesome plugin here!

  40. Justin says;
    20 Apr 2009 - 9:44am |

    Glad it’s working for you! I’m not a huge fan of the “magic number” concept that I’m employing right now, but at least it allows everyone to get the times set properly. Hopefully this summer I’ll be able to get some new features added in and solidify the timezone issues somewhat. Thanks very much for using my plugin, I never would have guessed it would be as popular as it is.

  41. Hi,
    Based on your work I created a new version of this parser :

    It’s based on the version 0.1 and is not fully clean but should work

    it works as a widget.

    at the beginning file_get_content didn’t work for me on one of my server, and after some research in wordpress codex. i found a function for retrieving files : wp_remote_get()

    Hope it helps.

  42. Maybe I’m a tard, but I can’t figure out how to get this plugin to display on my new blog using wordpress. Where is it that I’m supposed to insert that function? Do I need to include those div tags?

    Sorry for the dumb question but I don’t want to keep changing things and refreshing to see if something’s changed.

  43. Justin says;
    22 Apr 2009 - 6:48pm |

    Sam, to use the plugin, make sure it’s enabled in your admin panel first (which I’m sure you did), then add gcal_parse_feed() in your sidebar.php file, for instance. You need to make sure that function is called inside php tags (< ?php gcal_parse_feed() ?>).

    Let me know if you’re still having trouble.

  44. Justin says;
    22 Apr 2009 - 7:05pm |

    Hi, Thanks very much for working on the plugin! I was actually unable to find a function called wp_remote_get(), but looking for it did lead me to wp_remote_fopen(). That function does pretty much what you said the other one would do and I’ve taken a quick second to replace file_get_contents() with this WordPress function to hopefully make the plugin more compatible across hosting providers. Thanks very much for your help! I and all the users of the plugin really appreciate it.

  45. matthew says;
    29 Apr 2009 - 8:15pm |

    Hello, I’m excited to try your plugin, but I’ve gotten an error when trying to activate. I’m running WP 2.7

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /…/wp-content/plugins/google-calendar-feed-parser/gcalparse.php on line 112

    any suggestions?

  46. Justin says;
    29 Apr 2009 - 9:23pm |

    Matthew, I’ve had reports of that same error occurring in the past and it seems to be a problem with PHP version 4. If you have some way of upgrading to PHP 5 (some hosts offer this), that should fix the error. If you aren’t sure what version you’re running, create a test php page with the following in it: “< ?php phpinfo(); ?>” and then visit that page in a browser.

    Unfortunately at this point I don’t know of any other workarounds to fix this issue (other than upgrading PHP). Let me know how it goes for you.

  47. John says;
    30 Apr 2009 - 10:21am |

    didn’t work. without the space it did:

  48. John says;
    30 Apr 2009 - 10:28am |

    “” didn’t work. without the space it did: “”

  49. Jason says;
    30 Apr 2009 - 6:40pm |

    Hi there,

    Just letting you know that I’m also getting that same error on my WP 2.7 and my hosting account at godaddy has PHP 5 support.

    Parse error: parse error, unexpected T_OBJECT_OPERATOR in /home/content/v/i/a/viajero88/html/delafrontera/wp-content/plugins/google-calendar-feed-parser/gcalparse.php on line 112

  50. matthew says;
    30 Apr 2009 - 7:32pm |

    That did it.

    I had actually switched on php 5 a while back. But the change hadn’t gone through for some reason. Support found the problem and presto, I’m ready to roll…

  51. Followed the instructions, set up the feed, and I get the following right out of the box:

    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, ‘<’ not found in /home/bjhelms/public_html/wp-content/plugins/gcalpars/gcalparse.php on line 104

    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Unknown projection:basic&max-results=4 in /home/bjhelms/public_html/wp-content/plugins/gcalpars/gcalparse.php on line 104

  52. Justin says;
    02 May 2009 - 11:26pm |

    Everyone, thanks for being diligent in reporting the errors to me. Unfortunately, I haven’t been able to recreate the problem in my own tests (yet). I have some time this week and will try to figure out what’s causing this.

    @John: It seems that what you tried to post didn’t quite work. If you think you’ve found something that fixes this issue, please email me and let me know.

    Thank you all for your patience and I apologize for the trouble this upgrade has caused you all. Please bear with me while I attempt to find and solve the problem.

  53. Justin says;
    02 May 2009 - 11:28pm |

    bjh, it looks to me that something might be wrong with the URL you have set for your calendar’s XML feed. Double-check that and then make sure that you can visit the same URL in your browser properly. If you’re still having trouble, please let me know.

  54. Can you update your instructions to state exactly how to build the URL that should go into settings? I tried going into the settings for the calendar and simply getting the HTML link, and that doesn’t appear to work.

    It looks like a cool plugin, and I’m looking forward to using it.

    Thanks for the help.

  55. Lucas says;
    14 May 2009 - 1:21pm |

    Hey Justin, great plugin! There is any way to add the gcal_parse_feed() method call on a page? I just want to show my calendar on a page, without editing template files. Thanks

  56. matthew says;
    15 May 2009 - 1:34pm |

    Thanks for the fantastic plugin. There seems to be one problem with timezone offset.

    gcal_parse_feed() gives me a list with the correct times (using an offset of 10800), but clicking through to event details shows the incorrect time for a visitor without a google account.

    Embedding a google calendar leads to the same event details page, but seems to retain timezone settings. It’s URL finishes with ctz=America/New_York

    thanks again!

  57. Denis says;
    18 May 2009 - 11:21am |


    I confirm the bug underlined in http://wordpress.org/support/topic/270379?replies=2

    After activating in my sidebar, the page outputs “Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected” etc…
    Those PHP warnings I guess I could hide, but then I get a

    “Fatal error: Uncaught exception ‘Exception’ with message ‘String could not be parsed as XML’ in..”

    Wish I could use that plugin, looks promising ! let me know if i can help understand and debug.

    Using WP 2.7.1 on a very recent Linux dedicated server.


  58. Colin says;
    21 May 2009 - 3:36pm |

    Having the same trouble as ‘bjh’. My XML url works fine in the broswer:


    Yet, when I insert this as the Feed url on the Google Calendar Feed Parser Settings page, then enable the ‘Executable PHP widget’ for the sidebar, then insert the code into that widget…. it returns all the same text as ‘bjh’ mentions above.

    Any ideas? Thanks!

  59. Wayne says;
    27 May 2009 - 2:21am |

    I have a few questions.

    Is there a way to force a hard return between the date and the time?

  60. Ryan says;
    01 Jun 2009 - 1:00am |

    Great plugin! Work great. @bjh – Check and see if the url you put in your admin panel was “http://” and not “feed://”. That may solve your issue.
    Thanks again!

  61. I’m working on a site that needed Google Calendar feed parsing and found your awesome little plugin. Sweet. Only problem I had with it – it doesn’t work with the current WP 2.7 widget architecture. So, I could have bugged you and begged you to add that, but… Naw, free plugin, you’re probably a busy guy (Lord knows I am) so why not figure it out myself.

    So I did. I upversioned it to 0.4 just to avoid any weird conflicts. You can grab it from here:


    I made a change to the output function – I thought I’d need to extract the display code as a single string (I was wrong) so I wrote a new function (gcal_get_feed_string() ) to replace all the echoes with a single variable that gets returned. I then rewrote the gcal_parse_feed() function to just echo the return from my new function.

    I also added a chunk of code at the top to make the widgets work.

    Let me know if you run into any problems or anything. I tested it on my install and, so far, so good.

    Rob Z.

  62. OH – and I rewrote the code that grabs maxresults – I’m using this for a Google Apps calendar and, apparently, the feed url for it doesn’t accept the maxresults query string variable. So, you’ll get the firehose when you grab the calendar. This… needs to be reworked, methinks.

  63. I updated the parer again. It turns out I was not using the “full” version of the feed, hence why the maxresults wasn’t working. I set it back the way it was (still with the widget intact) and posted it on my site for future reference:


  64. Kevin says;
    09 Jun 2009 - 11:59am |

    bjh – it appears that if the gcal parser can’t get a response from google then it goes haywire and fails. I have been having this problem too, but google calendar appears to be down for domain users. It would be great to have error handling for this circumstance because I don’t want my users seeing a bunch of garbage if there is no feed available… caching also might help both reduce server load and prevent shorterm google outages from affecting users.

  65. Do you have instructions somewhere on how to style the CSS for the results? I see that you have a screenshot with styled results, but can’t figure out how you did that. I put the code in my sidebar.php file, but am not sure how to style around it.


  66. Kristoffer says;
    10 Jun 2009 - 6:53pm |

    I have the exakt problem as bjh, tried the feed URL in a browser and that works fine…

  67. Scott Clark says;
    15 Jun 2009 - 5:44pm |

    Just added this to a WP 2.8 site… got this:

    Parse error: parse error, unexpected T_OBJECT_OPERATOR gcalparse.php on line 112

    Tried re-install.


  68. Sumair says;
    15 Jun 2009 - 9:36pm |


    I tried setting up and pointing to the url : http://www.google.com/calendar/feeds/xxxx.com/public/basic for the feed url and tried pasting “” into the html code of a page but it doesnt seem to work…

    any idea how i can get this working?


  69. Eric says;
    16 Jun 2009 - 2:03am |

    Man, I’m a complete noob with no programming background. What is a call function? I’ve tried googling this and it’s like reading greek to me.

  70. Can you help me either not show endtimes or show enddates with the endtimes?

  71. Hi,
    What do I have to change in the code in order to retrieve information from the google calendar such as location of the event and the description?


  72. Hey there… Awesome plugin. I am trying to recreate what you did on your screenshot, however I am having some trouble. I put in the XML feed URL in the settings area and also in the RSS feed widget on my sidebar. When I do this it brings up events with the wrong date and it repeats them. Not quite sure what’s happening, but how do I do what you did on your example screenshot? Thanks

  73. rpicrew says;
    17 Jul 2009 - 1:40am |

    I have the same question as Lucas. Is there a way to implement this on one of my pages on my site? I’d like to implement this without editing any templates.

    Any help would be appreciated.

  74. Before, you’d click the link, and the box would pop up. Now it just opens the whole thing, so you have to hit “back” to get back. What went wrong? Does it not support the most recent version of WordPress? It worked fine before I upgraded to the latest version.


  75. Thanks for the neat plugin! I am a novice at all of this, but am wondering if there is any way to better handle “All Day” events from the Google Calendar. They are being displayed as a 2:00am start time for me (in in Raleigh: EDT). What I’d like is a condition that if 2:00am is the start time, then just suppress \f\r\o\m\ and onward (just display a date – no time – for these events).


  76. Still having a problem with All Day events. I dug into this a little more and found that Google Calendar does not send a Time variable for all day events. So what I really want is an “If/Else” scenario where all day events result with only the date displayed, and all others show the date and time. I just don’t have the PHP skills to build the If line for handling events with no time parameter. Help!!

    Also, I would like to display the list if items grouped by day. This page does exactly what I mean.
    He has the current date, then all of the events on that date and so on. How can we do a query like this?

  77. update: based on what arley commented above i also changed “basic” to “full” in the url to avoid further errors.

  78. Love the idea of your plug-in. I have something similiar on the site now, but would love to have it come from a Google calendar. Just way more flexible. But I’m pretty new at this, so I am having a problem. I uploaded the parser to the site and that part works. Then I put in the URL of the calendar (I think). I got it by going under Calendar Details for my calendar and then picking HTML and then cutting and pasting the whole string into the Parser settings. Then I opened the Widget tab, added a text box, and cut and paste the PHP code into the text field. When I try it, I get a textbox, but there are no dates in the box. Is that not a valid way to use the parser? I am using some prepurchased templates (Artisteer), so I don’t have much knowledge of the construction of my site. Thanks in advance. Lene

  79. Justin says;
    26 Oct 2009 - 9:13pm |


    First, you will want to choose “RSS” in your Calendar Details as opposed to “HTML”. Second, I’m not certain that the plugin will work within the Widget interface. If changing to the RSS format as I mentioned doesn’t fix the problem, try copying the php code for my plugin directly into your theme’s template (typically the files will be titled well, so if you want the calendar feed to appear in the sidebar, try looking at your theme’s sidebar.php in the theme editor). Also, you may want to look through some of the comments on this post as well as the other parser-related posts on my blog for mention of a widgetized version of my plugin (I know someone created one I just can’t remember where I talked about it).

    Let me know if you have any other issues.


  80. sarah says;
    03 Nov 2009 - 10:35am |

    one stupid question but where am I to find this
    Feed URL: This is the URL of the feed you wish to incorporate in your blog. It should be of the form:

    I have a google calendar but can’t seem to find the url of the feed…

  81. [...] Google Calendar Feed Parser [...]

  82. [...] been using Google Calendar Feed Parser to generate a sidebar box with upcoming events for quite a few websites. It’s a handy little [...]

  83. Ryan Regalado says;
    21 Nov 2009 - 1:51pm |

    Hello everyone. With the issue of “parser error : Start tag expected”

    I did a little debugging and found out that the hard-coded feed parameter of “&max-results” was causing the issue. I commented out this line and got it to work but still need to figure out how to get only the first 3 to 5 items instead of all of them.

    //$feed_url .= ‘&max-results=’ . (( get_option(‘gcal_max_results’) == ” ) ? ’4′ : get_option(‘gcal_max_results’));

    I need to learn these feed parameters

  84. I’ve tried adding the function directly to the template, but when I do, everything from the call on in the template disappears. Any HTML or php just disappears.

    I tried putting in echo statements before and after the call and it is clearly the call that’s aggravating things.


    Any ideas?

  85. Changed the timezone offset to -18000 to fix it for now.

  86. I have a problem with the time displayed for my calendar. I tweaked the code to adjust the display and everything works great on the home page. But on every other page, the time is displayed off by 5 hours, as GMT. When I click on the link, the time is displayed by Google correctly.

    Here is the Feed URL

  87. Ever since daylight savings time, my calendar is off in the upcoming events by an hour…but it’s right in the Google Calendar page.
    I changed the seconds offset, and it fixed some…but now others are a day early.

  88. I have restored the current version of the code and still have the same problem. The behavior of the code is different on home pages than on other pages. I have tried this on both the Titanium abd bChurch themes from iThemes.
    My offset is 0, not the default 7200.

  89. Justin says;
    31 Mar 2010 - 9:15am |


    When I initially designed this plugin I ran into the issue of timezones, as you are both seeing. The problem is that Google, your web server and PHP are all configured for a particular timezone, which may or may not be the timezone you’re actually in. I attempted to compensate for misinterpreted times by including the customizable offset, which works in many cases.

    Chuck, the problem you’re seeing with some events being off by a day is certainly odd and not one that I’d heard of yet.

    I have a few ideas for ways I could remedy these issues. I will try to do some research in the coming days and will certainly let you know via a comment here and a new blog post if I come up with anything that will help you. (maybe it’s time for a 0.4!)

Add a Comment