Support

Home Forums Event Espresso Premium Date to show in elementor

Date to show in elementor

Posted: September 2, 2020 at 6:05 am


shooin

September 2, 2020 at 6:05 am

Hello, I am trying to get the date to show on a Elementor widget and I was told to add this to the fucntion but I am not sure how to query the date. \

add_filter( ‘uael_post_event_date’, function( $date, $post_id, $date_format ) {
$event_date = get_post_meta($post_id, ‘event_date’, true);
return $event_date;
}, 10, 3 );

I need to replace ‘event_date’ with somthing that will pull in the Event Expresso date.

Any help is appreciated.

Thanks

ShooMoe


Tony

  • Support Staff

September 3, 2020 at 7:21 am

Hi ShooMoe,

The easiest way to do this is by using our model system, which we have details on here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

To give you a working example, something like this should do that you are requesting:

add_filter( 'uael_post_event_date', function( $date, $post_id, $date_format ) {
    $event = EEH_Event_View::get_event($post_id);
    if ($event instanceof EE_Event) {
        $datetime = $event->primary_datetime();
        if ($datetime instanceof EE_Datetime) {      
            return $datetime->get_i18n_datetime('DTT_EVT_start', $date_format);
        }
    }
    return $date;
}, 10, 3 );

Note – the above is untested.

The support post ‘Date to show in elementor’ 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