Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using this plugin: http://wordpress.org/extend/plugins/event-organiser/

I notice a field in the widget called "Template (leave blank for default)". How would I use this field to show the standard list of events, but with only the date (not the time), and only display the year if it's not this year?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

The template field allows you to enter what will appear on the event list widget. It accepts various place holders (you can see the documentation here - the template can be used for the [eo_events] shortcode too).

One of the place-holders is %start{date-format}{time-format}% which outputs the start date/time of an event with the specified date and time format. If it is an all day event, the time format is ignored.

To output just the date part you can use it in the form $start{date-format}% for example

//Output date in the form 1st September 2012
$start{jS M Y}%

Currently, however, there conditional statements are not supported. But I may be adding the option to use a template file instead. This would use a template from your theme folder (if it exists) or else a default template file from the plug-in. This template file will simply contain a while loop (the same as you find in many themes) and would be responsible for outputting the event list.

This would give you a great degree of freedom since you can perform conditional statements such as

if( eo_get_the_start('Y') == date_i18n('Y') ){
    //Event starts this year - don't include year in date format
    echo eo_get_the_start('jS M');

}else{
    //Event starts in a different year - include year in date format
    echo eo_get_the_start('jS M Y');

}
share|improve this answer
    
Awesome!! Thank you so much. Here's what I ended up putting in the widget field: <a href="%event_url%">%event_title%</a> on %start{F j, Y}% –  Zade Sep 2 '12 at 2:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.