WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. kn1g
    Member
    Posted 1 year ago #

    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/

  2. kn1g
    Member
    Posted 1 year ago #

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

  3. kn1g
    Member
    Posted 1 year ago #

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

  4. kn1g
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    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;
    }
  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.