Support » Plugin: Event Organiser » Show Event Span Multiple Days in Single-event Template.

  • Resolved Jean LeSheep

    (@cyarema)


    In my custom single-event.php I’m using this code to display the Date and Time of my events:

    <?php if(eo_is_all_day()): ?>
    <!-- Event is all day -->
    <?php $date_format = 'F j\, Y'; ?>
    <?php else: ?>
    <!-- Event is not all day - include time in format -->
    <?php $date_format = 'F j\, Y \a\t g:ia'; ?>
    <?php endif; ?>

    Then this to show it:
    <h3><?php printf(__('%s','eventorganiser'), eo_get_the_start($date_format) );?></h3>

    If the event spans multiple days, it doesn’t show the end date (which I’d like to happen). Is there a way to do this without showing the end date on events that are only on one day? I’m assuming this would be part of of a conditional statement. I just don’t know what it is.
    Thanks in advance.

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

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

    (@stephenharris)

    You can use eo_get_the_start() and eo_get_the_end() to see if they match:

    if( eo_get_the_start( 'Y-m-d' ) != eo_get_the_end( 'Y-m-d' ) ){
           //Event spans multiple days
       }else{
           //Event is contained within one day
       }
    Thread Starter Jean LeSheep

    (@cyarema)

    Thanks Stephen….

    Not to feel stupid, but does this go where the <h3> tag is or does it go with where the $date_format is ?

    Thanks Again!

    Thread Starter Jean LeSheep

    (@cyarema)

    After a variety of trial and errors, I figured it out…on a test site!

    <?php if( eo_get_the_start( 'F j\, Y' ) != eo_get_the_end( 'F j\, Y' ) ){?>
    <h3><?php printf(__('%s','eventorganiser'), eo_get_the_start('F j\, Y' ));?>
    <?php printf(__('%s','eventorganiser'), eo_get_the_end( ' \-\ F j\, Y' )  );?></h3>
    <?php }else{ ?>
    <h3><?php printf(__('%s','eventorganiser'), eo_get_the_start('F j\, Y \a\t g:ia' ));?>
    <?php printf(__('%s','eventorganiser'),  eo_get_the_end( '\-\ g:ia' )  );?></h3>
    <?php  } ?>
    <?php endif; ?>

    Not sure if there is a better way of doing it, but it’s functional if anyone else has experienced this problem.
    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Event Span Multiple Days in Single-event Template.’ is closed to new replies.