[EventCalendar] Create Page with Events Only

Matt Dawson matthewtdawson at gmail.com
Sat Feb 24 15:47:21 UTC 2007


So here it is. My apologies to whomever wrote this function - I can't find
it on the mailing list archive.

Take the following code and save it in your theme's folder as functions.php.
If a functions file already exists, just paste it into that doc.

<?php

function mg_filter_the_date($the_date)
{
  $event_cat = get_option('ec3_event_category');
  if (in_category($event_cat) || is_category($event_cat))
  {
    $the_date = ec3_get_schedule('%s ','%1$s %3$s %2$s. ','%s');
  }
  return $the_date;
}

add_filter('the_date', 'mg_filter_the_date');
add_filter('the_time', 'mg_filter_the_date');

?>

This looks at the event category for your site, and if the post in question
is in that category, it calls ec3_get_schedule and reassigns that info as
the posts date/time. Of course, this means that you can't access the post
date anymore. So if you have a situation where you need to show both the
event date and the post date, this isn't a viable option.

If you're the original author, stand up and be thanked. I owe you one.

Matt

On 2/23/07, Michael Schumann <lanval at gmail.com> wrote:
>
> Hi Matt,
> If you could post this trick that would be great! :)
>
> Michael
> On 23-Feb-07, at 3:57 PM, Matt Dawson wrote:
>
> It's worth noting that I'm also using a function in my theme that
> substitutes event date info for post date info for any post marked with my
> events category. This allowed me to snag the event date by calling
> the_time(). I got that trick from this mailing list, but I can repost if it
> would be helpful to others.
>
>
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://penguin.firetree.net/pipermail/eventcalendar/attachments/20070224/35ccf4bf/attachment.html


More information about the EventCalendar mailing list