Published
Monday, January 4, 2016 - 09:47
Written by

Last week was a busy one for the CiviEvent Widget plugin for WordPress.  Not only did it cross the 2,000 download threshold, but new features were added to help you display upcoming events in a flexible way.

First, an overview of the plugin.  I wrote CiviEvent Widget in response to the fact that CiviCRM sites on WordPress need an easy-to-use way to show their upcoming events.  Prior to CiviCRM 4.6, CiviCRM wouldn't render more than one instance of itself per page, including widgets; for example, you couldn't have CiviCRM list upcoming events in the sidebar alongside an individual event page.

The CiviEvent Widget bypassed this limitation to display a listing of upcoming events as a native WordPress widget.  Over the past two years, new features have been added, such as options for displaying the event location and summary.  Even as it's now possible to insert CiviCRM content in shortcodes all over the place, the CiviEvent Widget makes for an easy way to display a listing of upcoming events in WordPress.

Other additions this summer and fall include a widget for displaying the single next upcoming event and the ability to add both widget types as shortcodes.

The newest additions comprise a separate "Custom" mode for setting up a CiviEvent Widget.  Many people have requested the ability to show custom fields or rearrange the order of fields in the widget.  The "Custom display fields" option allows you to choose the fields that appear in each row of the widget, with the option to display the field's title, wrap it in a <span> tag with field-specific classes, and set a custom prefix and/or suffix for the field.  Besides the standard event fields and custom fields, I added a few "magic" fields such as the event title linked to the event info page.

A basic user interface allows for picking fields and setting options in the widget, and it generates a JSON string that you can use for setting it up as a shortcode.  You'll almost certainly want to write some CSS in your theme to handle display--all fields will appear alike otherwise.

There's also the need for narrowing the event listings.  By default, the CiviEvent Widget includes events starting today or later that are marked as "public".  Maybe you want a listing limited to workshops, or maybe you want to show the most recent past events in reverse chronological order.  The "Custom API filter" option allows you to enter JSON API parameters that will be used to filter the events.

Certainly, both of these newest features are aimed at the more advanced user, but they're intended to bridge the gap between the simplest needs and writing custom code.  Let me and my colleagues know if you have ideas for future versions.  The support forum on WordPress.org is a great place to report bugs.

Comments

We're playing around with the widget, both in the sidebar and the body of a page. So far it's working really well!

Next step for us is to style the CSS, though it looks good as is.

Thanks, Andrew!