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


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?

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 3 weeks, 2 days ago ago

Topic Tags

Notifications

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