[EventCalendar] Create Page with Events Only
matthewtdawson at gmail.com
Fri Feb 23 21:57:53 UTC 2007
Reposting in this thread, just in case. Sorry for the duplicate emails,
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 date.
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:
> Can you post your template code for this. It would be a great example.
> On 22 Feb 2007, at 21:50, Matt Dawson wrote:
> > There are any number of ways to accomplish this task.
> > I opted to create a page in WP, and then within that page, simply
> > use WP's
> > query_posts() function to get at the posts I wanted. In my case, it
> > made
> > sense to actually pass the advanced query ec3_after=today to
> > query_posts()
> > as an argument. I wonder if anyone else is using this method, as I
> > haven't
> > seen any support posts suggesting it as an option.
> > Your mileage may vary. If you want to go down this path, drop me a
> > line.
> > Matt
> > On 2/22/07, Sam Mooney <sam at aude-france-property.com> wrote:
> >> I did that - see www.audecentric.com the coming events link in
> >> the nav
> >> bar
> >> goes to this page - http://www.audecentric.com/upcoming/.
> >> I installed exec php plugin - http://bluesome.net/post/2005/08/18/50/
> >> I used the get events function
> >> http://wpcal.firetree.net/template-functions/ec3_get_events/ and
> >> changed
> >> the
> >> number of events to 300.
> >> -----Original Message-----
> >> From: Justin Bugajski [mailto: jmbugajski at gmail.com]
> >> Sent: Thursday, February 22, 2007 7:25 PM
> >> To: eventcalendar at firetree.net
> >> Subject: [EventCalendar] Create Page with Events Only
> >> I'm pretty new to WP and EC, so excuse the lame question if it's
> >> obvious
> >> to
> >> everyone.
> >> How I create a page that lists only the events category?
> >> Something like using this:
> >> http://blog.address/?ec3_days=7
> >> Only not using a link, but embedded in the page code so you click
> >> a nav
> >> button in the header and the page that comes up displays all the
> >> event
> >> details/posts...
> >> Thanks!
> >> _______________________________________________
> >> Blog: http://wpcal.firetree.net/
> >> EventCalendar at firetree.net mailing list
> >> Unsubscribe: http://penguin.firetree.net/eventcalendar
> > _______________________________________________
> > Blog: http://wpcal.firetree.net/
> > EventCalendar at firetree.net mailing list
> > Unsubscribe: http://penguin.firetree.net/eventcalendar
> 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