Past Events/Future (Current Events) out of order in Query Builder

I’m building out a current events and past event page on my site and it’s not working as I’m hoping. I am using the Query Builder to set this up but it’s not showing the content in order by Publish Date. My query is Posts: Event, Taxonomies: Any, Authors: Any, Date: Published After {{dc:global:date}}, Order By: Date Ascending, Count:99. Let me know if there are any additional steps that need to be taken or if you need more info. The link is below.


I am using Events Manager plugin to manage my events.

Hi @3HExapaT,

Thanks for reaching out.
I have checked the given page URL and found the dissimilarities in the Event Dates. Although it is a 3rd party plugin issue, we are still curious to know the reason behind that. Please note that we do not guarantee a fix or compatibility for conflicting code. As this is a 3rd Party plugin and we don’t have much control over the code. I would also suggest you contact the plugin author on this and let us know the feedback from them.
I would suggest you please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

Thanks

Thanks for looking into this. Using the plugin alone is shows in order but setting it up using the Query builder it shows this way. It could be an issue with the plugin, but I do appreciate you looking into this.

Hi @3HExapaT,

I have investigated it but didn’t find any reason behind the problem you described. I doubt that it might be some other plugin that is conflicting with the Event Manager plugin, I would suggest you deactivate all the plugins except the said one and check if that resolves your issue. If you find any plugin that is the reason behind your issue please contact the Event Manager plugin on this. I would also suggest you let us know the feedback from the Plugin Author on this.

Thanks

Thanks or looking. I did deactivate all the plugins except Event Manager and it viewed the same way. I will see if the plugin developer has any input on this. It did view as it should prior to pulling the data using Pro so I’m guessing they’ll say to contact the theme developer for a solution. May be at a dead end on this, unfortunately. However, I will try to see if they have a fix for this.

Hey @3HExapaT,

Great and let us know how it goes.

Thank you.

Hi, I’ve had no luck with Events Manager. Are there any Event plugins that work well with Pro?

Hello @3HExapaT,

You can use the Modern Events Calendar plugin. You can check out this documentation:

By the way, you should not be using the Looper Provider Query Builder. You need to use the Looper Provider Query String and query the needed date of the event. Perhaps this old thread can help you instead as your reference:

Best Regards.

Thanks for sending this over.

I haven’t worked in Query Strings before. I found a query string related to Events Manager and tried it out. Unfortunately it didn’t work. Do you have any suggestions on setting this up for Events Manager?

Thank you!

I was able to create a query string that brought in all the events and put them in descending order. However, it’s pulling in all posts and not those prior to the current date/time. This is what I have so far: post_type=event&posts_per_page=99&post_status=publish&meta_key=_event_start_date&orderby=meta_value&order=DESC

Any tips on pulling data prior to the current date/time in CMT? Will also need to do this for future events.

Hello @3HExapaT,

Following this thread, Best Practice? Looper with custom meta date, and then modify it to suit with the Events Manager, you will have something like this:

$meta_query[] = array(
    'key'     => '_event_start_date',
    'value'   => date('Ymd'),
    'compare' => '>=',
);

$query = array(
    'post_type'  => 'event',
    'meta_key'   => '_event_start_date',
    'orderby'    => 'meta_value',
    'order'      => 'ASC',
    'meta_query' => $meta_query
);

And by using the @Kory’s solution from this article (Looper Query String: Featured Products), you should be getting this query string:
post_type=event&meta_key=_event_start_date&orderby=meta_value&order=ASC&meta_query%5B0%5D%5Bkey%5D=_event_start_date&meta_query%5B0%5D%5Bvalue%5D=20220624&meta_query%5B0%5D%5Bcompare%5D=%3E%3D

where the “20220624” is the date of today. And to get the current Date, you will have to use the dynamic content date “ {{dc:global:date format="Ymd"}} ” which will then gives you:

post_type=event&meta_key=_event_start_date&orderby=meta_value&order=ASC&meta_query%5B0%5D%5Bkey%5D=_event_start_date&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format="Ymd"}}&meta_query%5B0%5D%5Bcompare%5D=%3E%3D

This may not work out of the box and serves as a mere example of how you can work with the Looper Provider Query String. You can manipulate the sample query above to get the past and/or future events.

Best Regards.

Thanks for looking at this for me. I’m still getting the same results in the data. I’ve added &meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format=“Ymd”}}&meta_query%5B0%5D%5Bcompare%5D=%3E%3D to my query so it is now: post_type=event&posts_per_page=99&post_status=publish&meta_key=_event_start_date&orderby=meta_value&order=DESC&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format=“Ymd”}}&meta_query%5B0%5D%5Bcompare%5D=%3E%3D

Any ideas on what may be incorrect in this?

Here is a link to the page showing the results: https://laialoha.org/lai-events/past-events/

Hey @3HExapaT,

After further investigation, you should be using this Query instead:

$meta_query[] = array(
    'key'     => '_event_start_date',
    'value'   => date('Ymd'),
    'compare' => '<',
	'type' => 'DATE'
);

$query = array(
    'post_type'  => 'event',
    'meta_key'   => '_event_start_date',
    'orderby'    => 'meta_value',
    'order'      => 'DESC',
    'meta_query' => $meta_query
);

which will then give you this string:
post_type=event&meta_key=_event_end_date&orderby=meta_value&order=DESC&meta_query%5B0%5D%5Bkey%5D=_event_start_date&meta_query%5B0%5D%5Bvalue%5D=20220625&meta_query%5B0%5D%5Bcompare%5D=%3C&meta_query%5B0%5D%5Btype%5D=DATE

Kindly let us know how it goes.