Events Manager
[resolved] Simplest way to get all Events as an Array (6 posts)

  1. kn1g
    Posted 3 years ago #


    just looking for the simplest way to get all Events as an simple Array like:

      array(All elements of Event1)
      array(All elements of Event2)

    I would try to get it directly out of the database. But if there is a more comfortable way, please let me know! :)

    I am trying to build a JSON controller to output the events.


  2. kn1g
    Posted 3 years ago #

    ok, sry. I tried only "output" before. I think "get" will do the job ;)

  3. kn1g
    Posted 3 years ago #

    Could it be that the option EM_Events::output(array( 'order'=>'DESC' does not work?

  4. kn1g
    Posted 3 years ago #

    tried $EM_Events = EM_Events::get(array('limit'=>$maxEventsDisplayed, 'orderby'=>'start_date'));
    But got in trouble as i tried to access the elements. like $EM_Events[0]['event_id'] was not possible. How can i access the elements of the class? (Didn't find a specific "getter" function) like "get_event_id".

    Sry, but i am still a bit confused by the structure of the Event classes and the task to loop properly through all events.

  5. agelonwl
    Posted 3 years ago #

    maybe this will help - http://wordpress.org/support/topic/plugin-events-manager-rss-feed-template-for-categories-located-where?replies=7


    $EM_Events = EM_Events::get(array('limit'=>$maxEventsDisplayed, 'orderby'=>'start_date'));
    foreach ( $EM_Events as $EM_Event ) {
     echo $EM_Event->event_id;
  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    you can also try this if you want just an array:


    However, the event objects can be useful as they have loads of functions to help display things, check bookings etc.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.