Category Archives: Feeds

WordPress events plugin with xml output? want it? why?

The IETF (Internet Engineering Task Force) has just published the RFC (Request for Comment) for xcal (iCalendar in XML).

Given that the ics format works fairly well to give us calendar exchange and interoperability (given the natural constraints of human involvement in import/subscribe to their calendar apps) , does one need an xml format too ?

An argument for the existence of an xml standard is that people have already developed their own xml versions – a standard was required for interchange of data.

If you have thoughts on this and would like to see that this wordpress events plugin produce an xml icalendar feed as well as the ics feed, please add  a comment below.

Try to be as specific as possible as to the reasons and benefits to motivate the addition of the xml format – export (and hmmm maybe import).

Some input to get you going:

I think the biggest software revolution of the future is that the calendar will be the organizing filter for most of the information flowing into your life. You think you are bombarded with too much information every day, but in reality it is just the timing of the information that is wrong. Once the calendar becomes the organizing paradigm and filter, it won’t seem as if there is so much.

 

 

hcalendar microformats By the way, did you know this plugin already issues the necessary css classes for the hcalendar microformat?

 

 

Custom wordpress feed issue (for ics feed)

For users of amr-events:

If you are:

  • using or offering your users the ics feed (to subscribe to whole calendar) and
  • you have more than 10 (or more accurately, more than your posts_per_rss feed parameter setting) active recent events, then please either
    1. In your wordpress settings> reading increase the “Syndication feeds show the most recent” (aka “post_per_rss”) setting to a number larger enough to cover all the events that you wish to include in the calendar subscription feed ( temporarily until the next larger upgrade – there should be one with additional features before Christmas).  This will also update the number of posts that show in your rss feed.       or
    2. upgrade to amr-events v 1.1.1 or
    3. manually apply the small code change below.

Code Change:

1. In file wp-edit-event.php, right near the bottom around line 604, find function ical_adjust_query. At the top of this function,before the other code  add:

//  if the query is doing the ics feed, then we need to make doubly sure that it will get all feeds, since wp overwrites the post_per_page parameter.

 if (isset ($query->query_vars['feed']) and ($query->query_vars['feed'] == 'ics'))
     add_filter('post_limits','amr_no_limits_for_feed'); // this filter will clear the  limits

2. Then above  function ical_adjust_query, add a new function:

function amr_no_limits_for_feed($limits) { //wordpress overwrites our 'unlimited posts_per_page' parameter if the query is n a feed and imposes the rss feed limit.  This will remove the limit. Only call if it is a ics feed
 return ('') ;
}

Why?

A user of amr-events (Shourin Sen , using the plugin for ip, entertainment and art law events) brought to my attention that the ics feed was not showing all events – it was behaving like an rss feed – only showing the last x events.

This was very puzzling since the ics feed code uses the same functions to get the event posts as the shortcodes and the widgets and they got all the data they needed.   It seemed like the “posts_per_page=-1″ argument passed was being ignored when in the feed.

post_per_page = -1 is supposed to fetch all posts.

I dug down into the wordpress code and at line 1687  in wp-includes/query.php found that if the query was in a feed, then wordpress fetched the “posts_per_rss” option and overwrote (without checking) whatever value was in post_per_page.

Is this a wordpress bug?

Maybe? – there may be a case for ignoring the parameter in case plugin or theme developers forget that changes they make to the query may impact the feed to,  although all the other examples do suggest checking whether in a feed or not before applying changes to the query, so arguably the wp code should not just overwrite it.

Certainly the codex needs to highlight this to help developers.  Therefore I have updated the wordpress documentation  in a couple of places, but I have not logged it as a bug in the wp trac.

Feedburner plugins and ical feeds

If you are using feedburner and a ical plugin that generates feeds, then please use the http://flagrantdisregard.com/feedburner/, rather than the feedsmith plugin.

The FD plugin allows for the possibility of some other feed (like an ical feed naturally!) and so will not hijack your ics feed like the feedsmith one does.

Alternatively

  • a simple hack to the google feedsmith plugin to check the global $feed variable and bail if it = ‘ics’ would also do the trick!
  • or if you maintain good coding standards and don’t like editing external plugins (not a good idea generally!), then you could muck around with the wordpress action template_redirect and see if you can remove the feedburner redirect IF it is a ics feed.