AM Events


The plugin adds a custom event post type with two taxonomies: event category and venue.

Allows the user to add new events just like normal posts with added fields for start time, end time, category and venue. You can also easily create weekly or biweekly recurring events.

Displaying the events is done in the theme files using WP_Query and the template tags provided by the plugin. This allows full control over the layout and what elements to show.

The plugin also includes a widget for showing upcoming events. It uses a very simple template system for full control of the layout.

For integrating AM Events to an existing theme, I suggest creating a child theme with custom page templates. You can find an example of a working Twenty Twelve child theme from containing three different page templates for event pages.

See Other Notes for detailed information and a small tutorial about the custom post type and the widget.

If you think something critical is missing, feel free to send me a request. I’m using this on some of my clients’ sites so I’ll certainly be improving/fixing it for upcoming WordPress versions.

The plugin is available in the following languages (pot-file included for additional translations):

  • English
  • French
  • Norwegian
  • Finnish

If you like my plugin, please consider donating!


Here are the shortcodes available in the upcoming events widget template.

  • [event-title]
  • [start-date]
  • [end-date]
  • [event-venue]
  • [event-category]
  • [content]
  • [thumbnail]
  • [excerpt]
  • [permalink]
  • [meta]

Conditional shortcodes:

  • [if cond=”startdate-is-enddate”]
  • [if cond=”startdate-not-enddate”]
  • [if cond=”startday-is-endday”]
  • [if cond=”startday-not-endday”]
  • [if cond=”has-venue”]
  • [if cond=”has-category”]

The title can be linked to the event post with the ‘link’ attribute, e.g. [event-title link=true]

The category and venue can also be linked similarly to their respective archive pages using the ‘link’ attribute, e.g. [event-category link=true]

The number of words displayed in the title, content or excerpt can be limited by the ‘limit’ attribute, e.g. [content limit=25] or [event-title limit=10].

The dates can be formatted using the ‘format’ attribute, e.g. [start-date format=’d.m.Y H:i’] (see PHP date for formatting options). If no format is given, the default WordPress date format is used.

You can use any shortcode as many times as needed in a single template. To separate date and time of start date for example you could write:

[start-date format='d.m.Y'] 
[start-date format='H:i']

Example usage of conditional shortcode:

[start-date format='D d.m.Y H:s'] 
[if cond='startdate-not-enddate']
 - [end-date format='D d.m.Y H:s'] 

Template tags

Template tags were introduced in version 1.3.0 and are listed below. More documentation can be found in the source files.

// Template tags for getting and displaying event dates
am_the_startdate($format = 'Y-m-d H:i:s', $before = '', $after = '', $echo = true)
am_get_the_startdate( $format = 'Y-m-d H:i:s', $post = 0 )
am_the_enddate($format = 'Y-m-d H:i:s', $before = '', $after = '', $echo = true)
am_get_the_enddate( $format = 'Y-m-d H:i:s', $post = 0 )

// Template tags for getting and displaying event venues
am_get_the_venue( $id = false )
am_in_venue( $venue, $post = null )
am_get_the_venue_list( $separator = '', $parents='', $post_id = false )
am_the_venue( $separator = '', $parents='', $post_id = false )

// Template tags for getting and displaying event categories
am_get_the_event_category( $id = false )
am_get_the_event_category_list( $separator = '', $parents='', $post_id = false )
am_in_event_category( $eventCategory, $post = null )
am_the_event_category( $separator = '', $parents='', $post_id = false )

Example of displaying the first category of the current event post:

$categoryArray = am_get_the_event_category();
echo $categoryArray[0]->name;<h3>Creating a WP_Query</h3>

The custom post type is named ‘am_event’
The taxonomies are named ‘am_venues’ and ‘am_event_categories’.

The event post has metadata named ‘am_startdate’ and ‘am_enddate’ that are formatted like ‘yyyy-mm-dd hh:mm’

So suppose I wanted to display all events with a category of ‘other’ and venue ‘mcdonalds’. I would then make a WP_Query like this:

$args = array(
        'post_type' => 'am_event',
        'post_status' => 'publish',
        'tax_query' => array(
                'relation' => 'AND',
                    'taxonomy' => 'am_venues',
                    'field' => 'name',
                    'terms' => 'mcdonalds',
                    'taxonomy' => 'am_event_categories',
                    'field' => 'name',
                    'terms' => 'other'

$the_query = new WP_Query($args);

if ($the_query->have_posts()) {
    while ($the_query->have_posts()) {

        $postId = $post->ID;

        // Use template tags to get start and end date
        $startDate = am_get_the_startdate('Y-m-d H:i:s');
        $endDate = am_get_the_enddate('Y-m-d H:i:s');

        // Use template tags to get venues and categories in an array
        $venues = am_get_the_venue( $postId );
        $eventCategories = am_get_the_category( $postId );

        // All the other functions used for posts like
        // the_title() and the_content() work just like with normal posts.

        // ...  DISPLAY POST CONTENT HERE ... //


If you want the events ordered by start date, add the following to $args:

'orderby' => 'meta_value',
'meta_key' => 'am_startdate',
'order' => 'ASC',

If you need to display only upcoming events, add the following meta_query argument to $args:

'meta_query' => array(
            'key' => 'am_enddate',
            'value' => date('Y-m-d H:i:s', time()),
            'compare' => ">",

The plugin folder also contains a file “examples.php”, which contains an example function for displaying upcoming events in a table.


  • Creating an event
  • Widget administration
  • Example page with events and the widget.


This section describes how to install the plugin and get it working.

  1. Upload folder am-events to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress


Can you give me an example of using WP_Query?

See ‘Other Notes’ for a simple tutorial.


Dead or still maintained

This plugin got loads of nice features unfortunately it hasn’t been updated for quiet a while now.

I tried to use this plugin on a site the other day but unfortunately the date picker didn’t returned the right format as well as the date field value send is not converted correctly to an unix timestamp it somehow always returns 0. Leaving you with only “1970-01-01 00:00:00” dates. Please look into this issue try different translations. I’m sure you have to use php’s function strtotime() here.

Good luck,

Cheers Fleuv

Read all 6 reviews

Contributors & Developers

“AM Events” is open source software. The following people have contributed to this plugin.


Translate “AM Events” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.



  • Updated jQuery UI date/time picker


  • Added new conditional shortcodes for venues and categories


  • Added hooks for including extra fields to event posts
  • Added [meta] shortcode for widget


  • Fixed problem with tags


  • Fixed admin panel event list ordering


  • Fixed tags being stripped from recurring events


  • Fixed compatibility with WordPress 4.3


  • Fixed date localization issues


  • Fixed widget category and venue filtering bug


  • Translation fixes.
  • Added thumbnail shortcode to widget


  • Fixed bug when removing event categories from recurring events


  • Improved handling of recurring events
  • Added start and end dates to quick edit


  • Added conditional tags for the widget


  • Added French language


  • Added option to change slug for event posts
  • Added [excerpt] shortcode for the widget
  • Added customizable “No upcoming events” message to widget
  • Added option to change how long passed events are shown in the widget


  • Added option to change time picker minute step
  • Fixed featured image and excerpts not copying when creating recurrent events


  • Fixed a few minor bugs


  • Added support for thumbnail and excerpt for event posts


  • Added new improved widget template shortcode system


  • Fixed minor bugs in template tags


  • Added template tags for getting and displaying event data


  • Fixed localization typos
  • Added simple WP_Query tutorial in ‘Other Notes’


  • Added support for PHP 5.2 (previously needed 5.3)
  • Fixed multiple bugs


  • Added localization to date format


  • Fixed bugs in the upcoming events -widget
  • Added missing examples.php


  • First released/stable version