First thanks for this awesome plugin! I need to display the events as a list, and after the time i need a word like “o’clock”, how is that possible? Been searching the webseite since hours *gg . I’ve read about these filters but i am new to these wordpress filters. is this the right filter to use in my case?
add_filter( 'eventorganiser_format_datetime', 'my_callback_function', 10, 3 );
function my_callback_function( $formatted_datetime, $format, $datetime ){
return $format;
};
And could you give me a hint how this filter has to look?
The output on the website looks like this:
“18. September 2014, 10:00”
but i need
“18. September 2014, 10:00 o’clock”
I tried it with a template in a loop and i don’t know how to change this:
$format = ( eo_is_all_day($event->ID) ? get_option("date_format") : get_option("date_format").', '.get_option("time_format") );
without getting an error. I think the filter method would be better(?)
Henning Fischer
I would probably avoid eventorganiser_format_datetime
– it’s a catch all filter, I would instead either change the time format option (in Settings > General), though this will affect other places on your website, so may not be appropriate. If it is, you just need to set it to:
G:i \o\'\c\l\o\c\k
(which will output something like 17:35 o’clock).
Otherwise you would need to specify the above (date and) time format when using the event list shortcode (see docs.wp-event-organiser.com/shortcodes/events-list). Lastly the events pages will have their own template (also, you could edit the event list shortcode template instead of using the placeholders), but in either case usually the time format will be specified by
get_option("time_format")
simply replace that with
'G:i \o\'\c\l\o\c\k'
Details of the formats you can use can be found here: http://php.net/manual/en/function.date.php
Stephen Harris
Thanks a lot, this worked! (‘G:i \o\’\c\l\o\c\k’)
🙂
Henning Fischer