Knowledgebase

Reverse Events Order In Earth WordPress Theme

A new option has been added to the theme panel in version 1.8 so you don’t have to edit your template files. yay!

If you wish to reverse the chronological order of the events on Earth theme (by default they are shown chronologically with the earliest post at the bottom – reverse chronological order – just like regular posts in WordPress) you’ll need to edit several files to include an order parameter in the loop to tell it to switch from the default WordPress descending order to ascending.

Example changing the home events:

* Open ncludes/home/events.php and edit lines 20-27:

//get post type ==> events
global $post;
$args = array(
 'post_type' => 'events',
 'numberposts' => $data['home_events_count'],
 'orderby' => 'meta_value',
 'meta_key' => 'timestamp_earth_event_start_date',
 'meta_query' => $meta_query
);

* to include an order parameter ( ‘order’ ==> ‘ASC’, ) as shown below:

//get post type ==> events
global $post;
$args = array(
 'post_type' => 'events',
 'numberposts' => $data['home_events_count'],
 'orderby' => 'meta_value',
 'order' => 'ASC', //This is the parameter added
 'meta_key' => 'timestamp_earth_event_start_date',
 'meta_query' => $meta_query
);

Edit Events Page & Widget

Do the same loop adjustment in the following files (add the order parameter following the lines provided):

* functions/widgets/featured-events.php – line 27
* template-events.php – line 46