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.

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Tony 1 month, 3 weeks ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!