Start date displays end date

Home Forums Calendar Products Events Calendar PRO Start date displays end date

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #216791
    barn2media
    Participant

    Hello,

    On the individual event page the “Start” date and time is showing incorrectly for events that are longer than 1 day long.

    The “Start” field shows the “End” date and time. If you view the example URL I’ve added to this post you’ll see that both the start and end show “June 13 @ 4:30 pm”, where as the start should show “June 13 @ 4:30 pm”.

    Taking a deeper look I see that that this is handled under /modules/meta/details.php and this file can be overridden by themes.

    I have reverted back to the default plugin file and also checked my theme and the details.php files and the code are identical.

    It looks like the tribe_get_start_date() function is not actually calling the start date.

    Many thanks for your help.

    Steven

    #216793
    barn2media
    Participant

    This reply is private.

    #217519
    Barry
    Member

    Thanks for sharing those details.

    I have to say I’m a bit perplexed and even if I faithfully set up an event with the same start and end dates/times I can’t see the problem locally. I do see you noted having already tried deactivating all other plugins and switching to a default, unmodified theme such as Twenty Thirteen … can you confirm what the outcome of that test was?

    Thanks!

    #226097
    barn2media
    Participant

    Hello,

    Thanks for your reply. On further diagnosis I’ve found out that this issue is happening when the following code is added to the function file of the theme. This snippet was provided by tribe as a way to disable past events from showing on the front end.

    This is needed on our website but it seems to be breaking the Start and End date display:

    add_filter(‘tribe_events_pre_get_posts’, ‘filter_tribe_all_occurences’, 100);
    function filter_tribe_all_occurences ($wp_query) {
    if ( !is_admin() ) {
    $new_meta = array();
    $today = new DateTime();
    // Join with existing meta_query
    if(is_array($wp_query->meta_query))
    $new_meta = $wp_query->meta_query;
    // Add new meta_query, select events ending from now forward
    $new_meta[] = array(
    ‘key’ => ‘_EventEndDate’,
    ‘type’ => ‘DATETIME’,
    ‘compare’ => ‘>=’,
    ‘value’ => $today->format(‘Y-m-d H:i:s’)
    );
    $wp_query->set( ‘meta_query’, $new_meta );
    }
    return $wp_query;
    }

    #229479
    Barry
    Member

    OK – so that’s from this thread, right?

    If so, it looks like Brook left that open and is waiting on your confirmation that it works – so if there’s a problem with that snippet and you want to hit Brook up for some extra ideas on that front, that’s probably the best course of action here 🙂

    #723292
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Start date displays end date’ is closed to new replies.