WordPress.org

Forums

Events Manager
[resolved] Upcoming Events (5 posts)

  1. SCRSCCA
    Member
    Posted 3 years ago #

    <?php
    
                $events_cat = array( array(2,'SOLO','solo'), array(4,'PDX/TIME TRIAL','pdx-tt'), array(3,'CLUB RACING','clubracing') );
    
                foreach ($events_cat as $cat) {
    
                    list($cat_id,$cat_name,$cat_stub) = $cat;
                    echo '<h3 class="' . $cat_stub . '"><a href="/' . $cat_stub . '/schedule/">' . $cat_name . '</a></h3>';
    
                    $events_list = EM_Events::get( array('limit'=> 1,'category'=> $cat_id,'array'=> 1) );
                    $event = $events_list[0];
    
                    if (!$event) {
    
                        echo '<p>No events scheduled</p>';
    
                    } else {
    
                        $start = strtotime($event['event_start_date']);
                        $end = strtotime($event['event_end_date']);
                        $event_date = ($start == $end ? date('F j, Y',$start) : date('F j',$start) . '-' . date('j, Y',$end));
    
                        $event_attrib = unserialize($event['event_attributes']);
    
                        echo <<<END
    
                        <dl>
                            <dt>{$event_date}</dt>
                            <dd><em>{$event['event_name']}</em></dd>
                            <dd>{$event['location_name']}, {$event['location_town']}</dd>
                            <dd><a href="/calendar/?event_id={$event['event_id']}">Details</a></dd>
    END;
    
                        if ($event_attrib['RegistrationURL']) {
                            echo <<<END
                            <dd><a href="{$event_attrib['RegistrationURL']}">Online Registration</a></dd>
    END;
                        }
    
                        echo '</dl>';
    
                    }
    
                }
    
                ?>

    Why doesn't this work?

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

  2. agelonwl
    Member
    Posted 3 years ago #

    hi,

    can I know where did you intend to use that snippet? e.g. single event template, categories template

  3. SCRSCCA
    Member
    Posted 3 years ago #

    It goes on our homepage template to display upcoming events.

  4. SCRSCCA
    Member
    Posted 3 years ago #

    It works find other then that fact that EM_Events::get seems to pull bad data. The homepage displays Jan 1st 1970 as the next event.

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    maybe the first array item doesn't have a key of 0? try array_shift()

Topic Closed

This topic has been closed to new replies.

About this Plugin

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

About this Topic