Support

Home Forums Event Espresso Premium Display upcoming events

Display upcoming events

Posted: June 20, 2016 at 8:50 am


SapphireBSL

June 20, 2016 at 8:50 am

Hi

I would like to display 3 (or however many) upcoming events on my homepage. Something along the lines of:

A PHP Loop to display 3 events
<div id=”Event Title”> ######### </div>
<div id=”Event Date”> ######### </div>
<div id=”Event Price”> ######### </div>
<div id=”Event Excerpt”> ######### </div>
<div id=”Event Link>Book Online</div>

Are there shortcodes I can use to do this. If not would you share the bits of code I need to pull into my php.

Thanks


Tony

  • Support Staff

June 20, 2016 at 4:01 pm

Hi there,

We do not have shortcodes to pull in each of those individual sections, however EE posts are Custom Post types (with some additional information) so you can create a similar loop that you would normally use for posts.

@josh has an example of a simple event list here:

https://gist.github.com/joshfeck/6e33532c37a123bbf532

You can also use the get_upcoming_events() to pull in all your upcoming events like this:

$events = EEM_Event::instance()->get_upcoming_events( 
    array( 
        'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
    )
);

$events will be an array of your upcoming EE event posts.

Is that what you are looking for?


SapphireBSL

June 27, 2016 at 2:49 am

Hi All

Is there somewher in the documentation that will tell me what the field names within the array are?
e.g. $event->name() = Event Name
So Event Title, Date, Price, Excerpt, Link would be …


Josh

  • Support Staff

June 28, 2016 at 7:28 am

You’ll find examples in the developer documentation:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/ee-model-objects-and-custom-post-types.md

https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-querying.md

https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/using-ee4-model-objects.md

The support post ‘Display upcoming 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.

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: closed

Updated by  Josh 3 years, 4 months ago ago

Topic Tags

Tagged: , ,

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.