WordPress.org

Ready to get started?Download WordPress

Forums

Event Organiser
[resolved] Events with Start and END date not working. (12 posts)

  1. c-bass
    Member
    Posted 2 years ago #

    hej,

    we also have events which are 2 months long and would like to show that in the single-event.php like:

    Event is from 15th of may until the 18 of july

    When edit the event and take for example the above dates, the end date will not appear.

    I am using the following code:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    What did I do wrong?

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

  2. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    Could you post your code in a pastebin? The forums have swallowed your code.

  3. c-bass
    Member
    Posted 2 years ago #

  4. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    The event from 15th of may until the 18 of july is a single event right? In which case eo_reoccurrs() returns false, and with that template the following is displayed:

    Am <?php printf(__('%s','eventorganiser'), eo_get_the_start($date_format) );

    To display the end date as well, change this to:

    Am <?php echo eo_get_the_start($date_format); ?> until <?php echo eo_get_the_end($date_format);?>

    (You can't translate a generic string %s - the dates should be translated if applicable anyway...).

  5. c-bass
    Member
    Posted 2 years ago #

    hej stephan,

    wow, thank you very much. exactly what I and hopefully a lot of others as well needed. i just got one little question:

    not all events are going over more several days. half of them are just single events and the way it is right now with your solution, it always shows the enddate as well, even though it is just a few hours later like:

    The events is from the 5ths April 2012 5pm (until the 5ths april 2012 9pm)

    how would the code be, if the text inside the brackets above shows just up, if the end date really is not on the same day, and if it is on the same day, it should onlye show the endtime and not the date?

  6. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    Someone had just that same question the other day.... :)

  7. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    To expand on that linked topic, once you've checked the dates are the same you can use eo_get_the_end but giving it a format argument that only contains time. E.g. eo_get_the_end('g:i a');

  8. c-bass
    Member
    Posted 2 years ago #

    Thanks. nice idea. i had the same thought, but when we really have a event with a different date, it would just show the time or what did you mean?

  9. c-bass
    Member
    Posted 2 years ago #

    the best solution would be something like this:

    IF event is on same day
    THEN Show Startdate with Starttime and Enddate

    ELSE
    IF event is longer than one day
    THEN show Startday with Starttime and Enddate with Endtime

    or?

    because with the way provided in your "suggested feature" forum is just compares if the STARTDATE is the same as the ENDDATE, but usually an event lasts for at lest a few hours and would mean that the events STARTDATE is not equal to the ENDDATE. what do you think?

  10. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    What I mean is:

    $start_date = eo_get_the_start('Y-m-d');
    $end_date = eo_get_the_end('Y-m-d');
    if($start_date == $end_date){
        //Event starts and ends on the same day
        echo 'This event is from '.eo_get_the_start('jS M Y g:i a').' until '.eo_get_the_end('g:i a');
    
    }else{
        //Event spans multiple days
        echo 'This event is from '.eo_get_the_start('jS M Y g:i a').' until '.eo_get_the_end('jS M Y g:i a');
    }

    (or however you want the date formated) - the point is you just compare the date parts.

  11. c-bass
    Member
    Posted 2 years ago #

    fantastic. that works pretty well. there is just one tiny thing. to do the same inside a post in wordpress with shortcodes, how would that be then?

    [eo_events]
    %start{d.F Y}{ \<\b\r\> G:i}% %end{ t\o\ G:i}% Uhr
    [/eo_events]

    The following works pretty well if the event is on the same day, but if the event spans multiple days it looks weired without the date. How can we work with multiple days in this case?

  12. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry for the delay in replying.

    Yes this is an issue I'm looking to fix. Either by introducing logic statements into the template or providing a 'clever' date output function. This function would take two dates and split them appropriately; e.g.

    21 May 2012 6pm and 21 May 2012 7pm become 21 May 2012 6pm-7pm etc.

    This can be expected in later versions of EO (1.4 maybe).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic