How to display something like "o'clock" after the time?

WordPress Event Management, Calendars & Registration Forums iCal Extension How to display something like "o'clock" after the time?

This topic contains 2 replies, has 2 voices, and was last updated by  Henning Fischer 9 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19471

    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
    #19475

    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
    #19493

    Thanks a lot, this worked! (‘G:i \o\’\c\l\o\c\k’)
    🙂

    Henning Fischer
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.