Viewing 6 replies - 1 through 6 (of 6 total)
  • You’ll need to edit the template files (see this).

    I would use eo_get_the_start(), eo_get_the_end() functions (see documentation) to the get the start and end date as a timestamp. If that is over two days, then display the end date as well as the start date.

    Something like the following should work (I’ve not tested it, so there may be some syntax errors!)

    $start_ts = (int) eo_get_the_start('U');
    $end_ts = (int) eo_get_the_end('U');
    
    if( $end_ts - $start_ts > 2*24*60*60 ){
        //Event lasts over 2 days. Display accordingly
    
    }else{
        //Does not - display differently.
    
    }

    The first argument for the eo_get_the_start/eo_get_the_end function is a string date format (php format). So you can display whichever part of the date you want (including just the day of the week – in php format this is denoted ‘l’ (lowercase L) ):

    echo 'This event starts on '.eo_get_the_start('l').' and finishes on '.eo_get_the_start('l');

    All examples above must be used inside the loop. To use them outside the loop you can pass the event ID as a second argument, (and the occurrence number as the third if applicable). See the above link for more details.

    Hi Stephen,

    I’m happy I found this question answered since I had the same. I must say I’m completely new to wordpress and php, still I managed to make these lines of codes work by adding a couple “<?php ?>”. There’s a detail I cannot correct though. In this situation, if an event starts and ends during the same month, I don’t want the name of the month to appear twice. I tried to create an if command inside the other if command (if command, that must be what you called a loop?) with these codes =
    <?php $month_start = eo_get_the_start(‘m’);?>
    <?php $month_end = eo_get_the_end(‘m’);?>
    <?php if( $month_start = $month_end ): ?>
    <?php printf(__(‘From %1$s to %2$s’,’eventorganiser’), eo_get_the_start(j), eo_get_the_end($date_format));?>
    <?php else: ?>
    <?php printf(__(‘From %1$s to %2$s’,’eventorganiser’), eo_get_the_start($date_format), eo_get_the_end($date_format));?>
    <?php endif; ?>

    But it does not work, it only shows the first choice even if the months are different. I guess it might be an issue with the equation, the equal sign perhaps?

    Thanks a lot for the pluggin and your time!

    In fact, I’d like to do the same in the event list widget and the codes seem to be different there, if you could help I’d be very grateful.

    Hi Rosenwinkel,

    Looks like a syntax error. You have:

    if( $month_start = $month_end ):

    should be

    if( $month_start == $month_end ):

    The widget is slightly more complicated as it would involve editing the core plug-in. I’m current looking at ways of allowing a template file to be chosen (rather than a placeholder template). This would template file would be similar to some theme files which deal with the while loop. The idea is that this file could be copied to your theme, and edited there to allow for more advanced logic like you wish to implement. The widget would use that template file for outputting the event list.

    It works great, that’s kind from you to help like that.
    There’s one last thing I’m trying to change, I simply want to remove the year from the event list widget and cannot find a way to do it. Where should I look? Is the date_format in a php file in the plugin or somewhere else in wordpress?

    You can use the template. It acts as a placeholder for the output, and is used in the event list shortcode too. See this page.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Event Organiser] End Date’ is closed to new replies.