WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] How to loop through events in PHP? (3 posts)

  1. rogue9607
    Member
    Posted 2 years ago #

    The small calendar file has a foreach loop that goes through each day looks to see if events are present.

    Is it possible to do something similar but with a full list of events (rather than calendar days) and access each attribute of the event (title, location, etc)?

    I've had some luck using:

    EM_Events::output( array('format'=>'<custom_format_here>','orderby'=>'event_start_date,event_start_time','pagination'=>0 ));

    but would like more control so I can apply different formatting based on attribute values.

    Thank you!
    Nick

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

  2. agelonwl
    Member
    Posted 2 years ago #

  3. rogue9607
    Member
    Posted 2 years ago #

    Thank you, it did give me an idea!

    I finally got the following simple example working which I've expanded on to get the functionality I wanted:

    $events = EM_Events::get(array('orderby'=>'event_start_date,event_start_time'));
    foreach ( $events as $event ) {
    	echo $event->output('#_EVENTLINK');
    }

    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.