Support

Home Forums Event Espresso Premium Event page 'Date & Times' displaying as 2017-09-09T16:00:00+00:00

Event page 'Date & Times' displaying as 2017-09-09T16:00:00+00:00

Posted: July 27, 2017 at 3:27 am

Viewing 5 reply threads


actonaid

July 27, 2017 at 3:27 am

Since updating to EE 4.9.x (we’re now 4.9.44p), our event page ‘date & times’ are displaying strangely (i.e. 2017-09-09T16:00:00+00:00). Have checked WP and EE date format and localisation settings and can’t see anything obviously wrong. All other dates and calendar entries appear fine. This is just happening on the event page ‘date & time’ box. Any ideas please?


Tony

  • Support Staff

July 27, 2017 at 3:47 am

Hi there,

That element is not a part of Event Espresso, did you have a developer customize the event details for you?

How is that ‘date & time’ box output?


actonaid

July 27, 2017 at 4:16 pm

Thanks for the prompt response. Yes, the site was delivered by a third-party developer originally, so there’s likely some custom code that needs updating, if this isn’t core EE functionality. We’ll try and hunt it down.


actonaid

July 27, 2017 at 5:24 pm

Yep, looks like we’ve got some custom stuff in our template’s single-espresso_events.php, that’s now formatting the dates & times slightly differently:

<?php
/**
* Template used for event detail page
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Acton Aid
*/

global $post;
$post = get_post($post->ID);

$event_id = $post->ID;

get_header(); ?>

<!– Begin Content –>
<div class=”container”>
<?php while (have_posts()): the_post(); ?>
<section id=”content” class=”event-details”>
<?php
$event = EEH_Event_View::get_event($event_id);

$id = $event->ID();
$name = $event->name();
$link = $event->get_permalink();

$date = $event->get_first_related(‘Datetime’);
$date = $date->get_date(‘DTT_EVT_start’);

$time = $event->get_first_related(‘Datetime’);
$time = $time->get_time(‘DTT_EVT_start’);

$venue = $event->venues();
$venue = !empty( $venue ) ? array_shift( $venue ) : NULL;

$event_content = get_page($event_id);
$content = $event_content->post_content;

if(class_exists(‘Dynamic_Featured_Image’)) {
global $dynamic_featured_image;

// Get all featured image including the WordPress one
$featured_images = $dynamic_featured_image->get_all_featured_images($event_id);
}
?>

<div class=”title”>
<h1><?= $name; ?></h1>
<span class=”visible-xs visible-sm”>
<span class=”calendar”></span>
<?= $date; ?>
Starts at <?= $time; ?>
Buy Tickets
</span>
</div>

<?php if(!empty($featured_images)): ?>
<div class=”images”>

<ul class=”rslides”>
<?php
$i = 1;
foreach ($featured_images as $image) {
echo ‘

  • Image ' . $i . ' of ' . $name . '
  • ‘;
    $i++;
    }
    ?>

    </div>
    <?php endif; ?>
    <div id=”main” class=”row”>
    <div id=”event-main” class=”col-md-8″>
    <h3>Description</h3>
    <?php
    setup_postdata($post);
    the_content();
    wp_reset_postdata($post);
    ?>
    <?php if(!empty($venue)) : ?>
    <h3>Location</h3>
    <p><?= $venue->name(); ?></p>
    <?php espresso_venue_gmap() ?>
    <?php endif; ?>
    </div>
    <div id=”event-sidebar” class=”col-md-4″>
    <div class=”sticky-sidebar”>
    <div class=”when hidden-xs hidden-sm”>
    <span class=”calendar”></span>
    <h3 class=”date”><?= $date; ?></h3>
    <p class=”time”>Start at <?= $time; ?></p>
    Buy Tickets
    </div>
    <?php the_block(‘Sidebar’); ?>
    </div>
    </div>
    </div>
    <div id=”buy-tickets” class=”tickets”>
    <h2>Buy Tickets</h2>
    <?php if ( espresso_display_ticket_selector( $post->ID ) && ( is_single() || ( is_archive() && espresso_display_ticket_selector_in_event_list() ))) : ?>
    <div class=”event-tickets” style=”clear: both;”>
    <?php espresso_ticket_selector( $post ); ?>
    </div>
    <!– .event-tickets –>
    <?php endif; ?>
    </div>
    </section>
    <?php endwhile; ?>
    </div>
    <!– End Content –>

    <?php get_footer(); ?>


    Josh

    • Support Staff

    July 28, 2017 at 12:01 am

    Where you have code like this:
    $date = $date->get_date('DTT_EVT_start');

    You can change it to something like this:
    $date = $date->get_date('DTT_EVT_start', 'M d, Y H:i');
    (you can set the format to any compatible PHP date/time format to your needs) or even:
    $date = $date->get_i18n_datetime('DTT_EVT_start');
    or even:
    $date = $date->get_i18n_datetime('DTT_EVT_start', 'M d, Y H:i');

    In the future please post entire PHP files into a github gist or pastebin.


    actonaid

    July 28, 2017 at 12:30 am

    That’s sorted it! Many thanks for your help guys, really appreciate it.
    (Apologies re: the code posting. I’m still learning the ropes with this)

    Viewing 5 reply threads

    The support post ‘Event page 'Date & Times' displaying as 2017-09-09T16:00:00+00:00’ is closed to new replies.

    Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

    Event Espresso