• Hi, I’m using the eo_events shortcode for softball events. Some are 3-day events (tournament), some are only one day. For the event shortcode I am grouping them by series. I would like to add the date, but if I add %schedule_start{F j}% – %schedule_end{F j}%, when there’s a one-day event, it shows the date as “June 6-June 6”. Is there a way to get around that using the shortcode?

    thanks!
    Julie

    https://wordpress.org/plugins/event-organiser/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    Hi Julie,

    So if I understand you correctly you want to be able to format the date differently depending on whether the event is recurring or not? Unfortunately that’s not possible using placeholders, you can however, ditch the placeholders and edit the template shortcode-event-list.php template file instead.

    That does require at least some familiarity with php, but it does give you complete flexibility. In that template file you can do something like eo_reoccurs() (see codex: http://codex.wp-event-organiser.com/function-eo_reoccurs.html).

    You may want to keep an eye out for 3.0.0 when its released later this year as it introduces a new function: eo_format_datetime_range().

    This takes two DateTime objects, and format string and a separator (by default a hyphen). It then formats the two DateTime objects as a range, inserting a hyphen where appropriate:

    $date1 = new DateTime( '2015-06-01' ); //1st June
    $date2 = new DateTime( '2015-06-05' ); //5th June
    $format = 'jS F Y'; //Format date as "1st June 2015"
    
    //3.0.0+ only:
    echo eo_format_datetime_range( $date1, $date2, $format );
    
    //Prints
    1st - 5th June 2015

    If the two dates ‘match’ it just displays the on:

    $date1 = new DateTime( '2015-06-01' ); //1st June
    $date2 = new DateTime( '2015-06-01' ); //1st June again
    echo eo_format_datetime_range( $date1, $date2, $format );
    
    //Prints
    1st June 2015
    Thread Starter delawaregrad

    (@delawaregrad)

    Thanks for responding!

    That’s a bummer because grouping events is such a great option, but those single events look silly with the date shown twice.

    I did make changes to the single-event-meta template so that for all day events, it would display “all day,” but I didn’t think about changing the shortcode template. I’ll look into that (the link you gave is going to an error page, but I’ll try to find it).

    Look forward to that new release.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Series and Non-series occurancees’ is closed to new replies.