it’s not possible out the box at the moment. it may be possible with custom coding but unfortunately we are quite limited with regards to custom coding as per the support policy – http://eventsmanagerpro.com/support-policy/
Ok, well this is what I did which seems to work….
/* code to add working next / previous links to single event pages on WP Event Manager (goes in theme / single-event.php) */
// use the global variable $wpdb to access the WordPress database
global $wpdb;
// get all events from the wp_em_events table, ordered by date and time
$all_event_ids = $wpdb->get_results("SELECT post_id FROM wp_em_events WHERE 1 ORDER BY event_start_date, event_start_time ASC");
// get this post ID (a single event page)
$postid = get_queried_object_id();
// index is used to count through $all_event_ids array until this post ID is found
$index = 0;
foreach($all_event_ids as $event_id){
// stop looping when index of this post found
if($event_id->post_id == $postid) break;
// or continue looping
$index ++;
}
// now...
// $all_event_ids[$index+1]->post_id is ID of next event
// $all_event_ids[$index-1]->post_id is ID previous event
// show 'previous' link if this event is not first
if($index > 0) {
echo '<a href="' . get_the_permalink( $all_event_ids[$index-1]->post_id ) . '">< previous event</a> ';
}
// show 'next' link if this event is not last of all events
if($index < count($all_event_ids)) {
echo '<a href="' . get_the_permalink( $all_event_ids[$index+1]->post_id ) . '"> | next event ></a>';
}
I think your query is wrong. Try this:
$all_event_ids = $wpdb->get_results("SELECT post_id FROM wp_em_events ORDER BY event_start_date ASC, event_start_time ASC")
Thanks Caimin, it’s not wrong, it works fine (though the WHERE is redundant).