• Resolved seifs4

    (@seifs4)


    I am using the Event List plugin in a custom theme and it is working quite nicely. I use PHP to access the start_date and title info from the wp_event_list table and display it in the sidebar of the site. However, most recently it quit displaying the most recent events and I was wondering if you might be able to tell me where things are going awry. I am posting my PHP below and if it helps, the site url is http://www.sauganashchamber.org

    Thanks in advance!!

    <?php
    
    							global $wpdb;
    							$result = $wpdb->get_results( "SELECT start_date, title
    								FROM wp_event_list
    								WHERE start_date >= CURDATE() LIMIT 7"
    								);
    
    							/*$result = $wpdb->get_results( "SELECT * FROM wp_event_list  LIMIT 7" );*/
                                foreach ( $result as $event ) {?>
    
    						<h4 class="green bold"><?php echo $event->start_date; ?></h4>
                            <h3 class="arial bold italic"><?php echo $event->title; ?>&nbsp;&nbsp;&nbsp;<a class="read-more arial bold" href="index.php?page_id=61">Read more</a></h3>
                            <div style="width:100%; height:1px; background:#D6E6E3;"></div><!-- horizontal rules -->
                            <?php } ?>

    https://wordpress.org/plugins/event-list/

Viewing 1 replies (of 1 total)
  • Thread Starter seifs4

    (@seifs4)

    I figured out the problem. I needed to let the database know what order I wanted it displayed, so I added “ORDER BY start_date” to the query.

    Like this: `global $wpdb;
    $result = $wpdb->get_results( “SELECT start_date, title
    FROM wp_event_list
    WHERE start_date >= CURDATE() ORDER BY start_date LIMIT 7″
    );`

Viewing 1 replies (of 1 total)

The topic ‘Access Event List Info from database’ is closed to new replies.