Support

Home Forums Event Espresso Premium Events listing by date and event name

Events listing by date and event name

Posted: August 31, 2020 at 2:34 am

Viewing 1 reply thread


cryamerica

August 31, 2020 at 2:34 am

Hello
We are trying to fetch Event names ordered by Event Start Date and then by Event name in a Event Category page
We are using this code to fetch event details
$term = get_term_by( ‘slug’, get_query_var(‘term’), get_query_var(‘taxonomy’) );

$args = array (
‘post_type’ => ‘espresso_events’,
‘posts_per_page’=>-1,
‘orderby’=>’post_title’,
‘order’=>’ASC’,
‘post_status’=>’publish’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘espresso_event_categories’,
‘field’ => ‘slug’,
‘terms’ =>$term->slug,
),
),
);

But we are unable to list events by event start date and event name.
Could you please help us with this

Look forward to hearing from you


Tony

  • Support Staff

September 1, 2020 at 7:41 am

Hi there,

I recommend learning how to use the EE4 model system for this:

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

The reason I recommend doing so is most of EE4’s event data is not stored under post meta but in custom tables and the model, system handles all of the joins for you.

Before going forward with this, you mention ‘in a Event Category page’, if you are already within an taxonomy listing are you not altering the main query for this? It looks like you are pulling an additional set of events, is that expected?

Viewing 1 reply thread

The support post ‘Events listing by date and event name’ 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