Support

Home Forums Event Espresso Premium Events Sorted by Start Date

Events Sorted by Start Date

Posted: November 23, 2023 at 3:47 am

Viewing 11 reply threads


ISME Skillnet

November 23, 2023 at 3:47 am

Hey guys,
Currently Event Dates are sorted by the creation date and not the start date. Which makes sense because the “events” page uses the Worpdress Archive, so it is displaying in the same manor as say a “Blog” page might.

I just want to see is it possible to change the sort order just on this page to the Start Date, or do i need to create a custom page and use the shortcode with filtering/ordering parameters?

Ideally it would be great if it could be done with the default setup.

Cheers
Dave


Sam

  • Support Staff

November 23, 2023 at 5:47 am

Hi Dave,

You can try creating a new page and add this shortcode to arrange the events by starting dates:

[ESPRESSO_EVENTS order_by=start_date]

You can check the shortcodes here: https://eventespresso.com/wiki/ee4-shortcodes-template-variables/


Tony

  • Support Staff

November 23, 2023 at 5:51 am

Hi Dave,

Currently Event Dates are sorted by the creation date and not the start date. Which makes sense because the “events” page uses the Worpdress Archive, so it is displaying in the same manor as say a “Blog” page might.

Whilst this is correct, EE filters the query to sort the events to be ordered by start_date by default (as that makes the most sense for most users when outputting the events) so if you are getting events listed by publish/created date then its likely something else is then filtering the order_by to change that.

Install Query Monitor and open up the events archive output.

Check the main query, it should show something like this:

https://monosnap.com/file/xB98wnK1gDSBVqUqjKRadAg7lscv1u


ISME Skillnet

November 24, 2023 at 4:13 am

Hey Tony,
Thanks for the response. Yeah that’s a negative on my query.. I have:

SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1
AND ((wp_posts.post_type = ‘espresso_events’
AND (wp_posts.post_status = ‘publish’
OR wp_posts.post_status = ‘cancelled’
OR wp_posts.post_status = ‘postponed’
OR wp_posts.post_status = ‘sold_out’
OR wp_posts.post_status = ‘private’)))
ORDER BY wp_posts.post_date DESC
LIMIT 0, 10

It appears the Avada theme is the culprit. Do you have any experience with this? It doesn’t appear to be an end user setting that can be configured.

Cheers
Dave


Tony

  • Support Staff

November 24, 2023 at 6:30 am

Hi Dave,

May I ask what makes you say it’s Avada?

I have a version of Avada locally and it doesn’t filter by post_date there, although it could be from a setting within the theme.


ISME Skillnet

November 24, 2023 at 7:05 am

Hey Tony,
Sorry to be more specific Avada Builder. I disabled the Avada Builder and the Query reverted back to exactly what you had in the screenshot you provided. Enabling Avada Builder and we are back ORDER BY post_date.

I have also made sure the builder is disabled for post type “events” on the hope that it may have been the issue, but unfortunately not.

Cheers
Dave


ISME Skillnet

November 27, 2023 at 2:57 am

Hey Tony,
We got an update back from Avada and they have suggested changing plugins. Which of course isn’t an option.

“We will suggest you to try Events Calendar plugin from Tribe that is compatible with Avada already”

Any assistance you can provide here?

Cheers
Dave


Tony

  • Support Staff

November 27, 2023 at 6:26 am

Can you send me the latest version of Avada, Fusion core and Fusion builder?

I’ve been looking into this and Avada hooks into pre_get_posts and runs a alter_search_loop method (there’s a few but the ‘issue’ remains the same) on that hook.

If first checks:

if ( ! is_admin() && $query->is_main_query() && ( $query->is_search() || $query->is_archive() ) ) {

So if not in the admin and is the main query and either a search or archive request.

Then it does this:

$search_override = Fusion_Template_Builder::get_instance()->get_search_override( $query );

Which calls $layouts = fusion_cached_query( $args );

Within that they run a new WP_Query, which appears to be what is breaking ours. One option would be to hook into pre_get_posts and remove their hook on EE archives, but there’s no easy way to grab the instance of the class setting the above either and no filters to bypass it.

I’ll see what else we can do here but can’t make any promises currently.


ISME Skillnet

November 27, 2023 at 8:18 am

This reply has been marked as private.


ISME Skillnet

December 7, 2023 at 7:26 am

Hey Tony,
Just checking in to see if there is any update?

Cheers
Dave


Tony

  • Support Staff

December 7, 2023 at 8:59 am

Hi Dave,

So this is a tough one.

I can see what is happening and the code doing it, but WHY it’s happening has so far hidden away from me.

I’ve asked one of our developers if he can take a look at this and I’ll let you know of any feedback given.


ISME Skillnet

December 11, 2023 at 4:16 am

Hey Tony,
No problem at all! Thanks for getting the dev to take a look. Would there be any chance they might get to take a look before Wednesday this week? Just this website is going live on Wednesday and needless to say it wouldn’t look great with out of order courses =D

Really appreciate the assistance on this.

Cheers

Viewing 11 reply threads

The support post ‘Events Sorted by Start Date’ 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