[EventCalendar] Event Listing on sub page
matthewtdawson at gmail.com
Fri Feb 23 21:15:18 UTC 2007
What I did was actually ridiculously simple. I created a WP Page, and paired
it with a page template that uses a specialized query_posts() call to filter
out non-event posts and order by event order.
The one caveat: I haven't taken the time to learn how WP Pages work. It
seems there's some kind of loop type call that allows me to do what I did in
the below code (ie. call the_title() outside of any loop that I built).
In any case, here's what I have in my page template file (emphasis added to
the pertinent call to query_posts()):
<h2><?php the_title(); ?></h2>
<?php query_posts('ec3_after=today'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="event_post" id="post-<?php the_ID(); ?>">
<h3 class="event_title"><a href="<?php the_permalink(); ?>"
rel="bookmark"><?php the_title(); ?></a></h3>
<h4 class="event_date"><?php the_time('F j, Y'); ?></h4>
<?php the_content(__('More...')); ?>
</div><!-- end event_post -->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no events matched your criteria. Please check back
<?php endif; ?>
The result can be seen here: www.214arts.org/calendar
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.
On 2/23/07, Alex Tingle <alex at firetree.net> wrote:
> Hi Rob,
> On 16 Feb 2007, at 18:44, Rob Dircks wrote:
> > I'm running a podcast with "fallseason" theme.
> > I want this page (http://www.acousticlongisland.com/upcoming-
> > schedule/) which was set up in WP Add Page
> > to look like this page (http://www.acousticlongisland.com/?
> > ec3_days=365)
> > How do I get WordPress to allow me to make that ec3 request the
> > page in my primary nav?
> Matt Dawson recently posted a solution to this requirement. Hopefully
> he'll post his code so we can all see it.
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the EventCalendar