WordPress.org

Support

Support » Plugins and Hacks » Events Manager » [Resolved] Simplest way to get all Events as an Array

[Resolved] Simplest way to get all Events as an Array

  • Hey,

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

    array(
      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.

    http://wordpress.org/extend/plugins/events-manager/

Viewing 5 replies - 1 through 5 (of 5 total)
  • ok, sry. I tried only “output” before. I think “get” will do the job 😉

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

    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.

    agelonwl

    @angelonwl

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

    e.g.

    $EM_Events = EM_Events::get(array('limit'=>$maxEventsDisplayed, 'orderby'=>'start_date'));
    foreach ( $EM_Events as $EM_Event ) {
     echo $EM_Event->event_id;
    }

    Plugin Author Marcus

    @netweblogic

    NetWebLogic Support

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

    EM_Events::get(array(‘array’=>true));

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Simplest way to get all Events as an Array’ is closed to new replies.
Skip to toolbar