WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to display a list of events by category and month. For example I need to list all the Mountain Bike events in July.

share|improve this question
Show us what you have tried already and where exactly you got stuck. – toscho May 2 '12 at 8:06
up vote 1 down vote accepted

You can use the plug-in provided function eo_get_events(). This is essentially a wrapper for get_posts(), and so is intended for 'secondary' loops.

The plug-in specific arguments can also be given to a WP_Query object - in case you wanted to modify the main loop. (Related: When to use WP_query(), query_posts() and pre_get_posts )

$events = eo_get_events(array(
        'taxonomy' => 'event-category',
        'field' => 'slug',
        'terms' => 'mountain-bike'

assuming mountain-bike is the slug of your category term

The only plug-in specific arguments here are event_start_after and event_start_before which accept a date string in 'YYYY-MM-DD' format (as above, or a relative date such as +1 week or third Thursday of this month - please note available relative dates will depend on your php version).

There are also event_end_after and event_end_before arguments available. All of these can be used in a WP_Query object too.

Please note eo_get_events() sets some defaults (See documentation).

Return is an array of post objects (of 'event' post type). This answer shows how to display the returned posts (see get_posts() section).

share|improve this answer
That's great - thank you very much – Brad May 2 '12 at 13:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.