[EventCalendar] Customising ec3_get_events display

Alex Tingle alex at firetree.net
Tue Dec 23 11:14:30 UTC 2008


On 23 Dec 2008, at 02:28, James Kirsop wrote:

> I think I've discovered a bug in 3.2 -- I can't seem to get the  
> ec3_listing=events to work at all (just by adding it to the query  
> string, or by the two options suggested below). I'm running WP 2.6.3  
> and the latest downloaded zip of the 3.2 dev.

Try switching to the default theme. Does that fix it?

Some people put something like,

  <?php query_posts('cat=1') ?>

...into their theme's index.php. That breaks everything. My suggested  
alternative goes something like this:

  <?php
   global $wp_query;
   if(is_home() && empty($wp_query->query))
     query_posts("cat=1");
  ?>

-Alex

--


> On 23/12/2008, at 2:41 AM, Alex Tingle wrote:
>>
>> You could just add the GET parameter ec3_listing=events into the  
>> ReWrite rule in your .htaccess file.
>>
>> Alternatively, you could try this simple plug-in:
>>
>> <?php
>> /*
>> Plugin Name: EC3 Events Only
>> Version: 1.0
>> Plugin URI: http://wpcal.firetree.net
>> Description: Requires EC3. Makes all queries event
>> Author: Alex Tingle
>> Author URI: http://blog.firetree.net/
>> */
>>
>> /** Force default query to be ec3_listing=EVENTS. */
>> function EC3EO_filter_parse_query(&$wp_query)
>> {
>> if(empty($wp_query->ec3_listing))
>>   $wp_query->ec3_listing = 'EVENTS';
>> }
>>
>> // Make sure the filter runs *after* EC3's.
>> add_filter('parse_query', 'EC3EO_filter_parse_query', 11);
>>
>> ?>
>
>
>>>> If you need finer control, then have a look at the advanced  
>>>> queries:
>>>> http://wpcal.firetree.net/advanced-queries/
>>> Some of these are great, but require some tweaking for what I'm  
>>> looking for. Eg. I'd like to show events from 'This Week' -- which  
>>> shows events from the Sunday before the current date, to the  
>>> sunday following the current date -- as opposed to showing the  
>>> 'next 7 days' which is what I've been using as a substitute until  
>>> I work out how to get the desired listing.
>>>>
>>
>> You should be able to do that with a custom query. Calculate your  
>> start and end dates and then use something like:
>>
>> query_posts("ec3_after=START&ec3_before=END");
>>
>> You can use query_posts() to drive a main loop, but it's best to  
>> make your own query object for a sidebar...
>>
>> $query = new WP_Query();
>> $query->query("ec3_after=START&ec3_before=END")
>> if($query->have_posts())
>> {
>>    ...
>>
>> Look at the implementation of ec3_get_events() in template- 
>> functions-new.phph for a fully worked out example.
>
> Great, thanks. Will do that when I get a few other things sorted out  
> first and let you know how I go.
>
> Regards,
> james
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar




More information about the EventCalendar mailing list