Adding time next to date for widget calendar.

We are asking for guidance to how we could add time next to date for the upcoming calendar widget or you could say add start and end time bottom of the calendar when someone clicks the date. This may make it more clear: https://www.screencast.com/t/pNWwAJ7LP7L

  • Vaughan
    • Support/SLS MockingJay

    Hey robert_velarde

    Can you try adding the following filter to your theme functions.php

    add_filter('eab-calendar-upcoming_calendar_widget-start_time', 'event_time_format', 99, 3);
    function event_time_format($event_times, $event_start, $event_id) {
        $start = date_i18n('d/m/Y H:i', $event_start);
        $end = date_i18n('H:i', strtotime(get_post_meta($event_id, 'incsub_event_end', true)));
    
        return $start . ' - ' . $end;
    }

    It should then display as 20/08/2018 20:00 - 21:30

    Hope this helps.

  • Vaughan
    • Support/SLS MockingJay

    Hi robert_velarde

    You can also try this instead:

    add_filter('eab-calendar-upcoming_calendar_widget-start_time', 'event_time_format', 99, 3);
    function event_time_format($event_times, $event_start, $event_id) {
        $date_format = get_option('date_format');
        $time_format = get_option('time_format');
        $start = date_i18n("{$date_format} {$time_format}", $event_start);
        $end = date_i18n("{$time_format}", strtotime(get_post_meta($event_id, 'incsub_event_end', true)));
    
        return $start . ' - ' . $end;
    }

    That will then display the date & time using the formats for date & time in the Wordpress General settings options.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.