-
-
Save jondcampbell/fce22cb0b701329a4b7c to your computer and use it in GitHub Desktop.
Query event espresso 4 events and order by the events start date. Using this instead of a wp query of espresso_events post type.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="events"> | |
<?php | |
$events_args = array( | |
'title' => NULL, | |
'limit' => 100, | |
'css_class' => NULL, | |
'show_expired' => FALSE, | |
'month' => NULL, | |
'category_slug' => NULL, | |
'order_by' => 'start_date', | |
'sort' => 'ASC' | |
); | |
// run the query | |
$events = new EE_Event_List_Query( $events_args ); | |
if ($events->have_posts()) : while ($events->have_posts()) : $events->the_post(); | |
?> | |
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> | |
<?php | |
endwhile; | |
else: | |
?> | |
<li>No Upcoming Events</li> | |
<?php | |
endif; | |
// now reset the query and postdata | |
wp_reset_query(); | |
wp_reset_postdata(); | |
?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment