Support

Home Forums Event Espresso Premium [ESPRESSO_MY_EVENTS] Sort code for current events.

[ESPRESSO_MY_EVENTS] Sort code for current events.

Posted: April 23, 2019 at 4:37 am

Viewing 3 reply threads


Phil Stott

April 23, 2019 at 4:37 am

Hi is there a short code to just show current events in My events list

ie [ESPRESSO_MY_EVENTS show_expired=False]

Thanks Phil


Tony

  • Support Staff

April 23, 2019 at 7:13 am

Hi Phil,

There’s currently no shortcode parameter for this, but it can be done with a small snippet of code in one of the templates copied to your themes root directory (preferably a child theme), are you comfortable with PHP and FTP?

By ‘current events’ do you mean upcoming and active events?


Phil Stott

April 26, 2019 at 6:57 am

Yep i want to show just events that are current or upcoming. I have a basic knowledge of editing php. Is it complex ?


Tony

  • Support Staff

April 26, 2019 at 9:17 am

Not really, but you need to create a child theme:

https://developer.wordpress.org/themes/advanced-topics/child-themes/

Copy the original template from the plugin:

\eea-user-intergration\templates\loop-espresso_my_events-event_section.template.php

Place the copy in the root directory of your child theme and edit the template there.

Add this code at the top of the template, just after the opening php tag:

$allowed_statuses = array(
    EE_Datetime::active,
    EE_Datetime::upcoming,
    EE_Datetime::sold_out,
);
if (! in_array($event->get_active_status(), $allowed_statuses)) {
    return;
}

That should remove the events that are not active, upcoming or sold out from the list.

Viewing 3 reply threads

The support post ‘[ESPRESSO_MY_EVENTS] Sort code for current events.’ 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