Theater for WordPress 0.13 released

Theater for WordPress 0.13 was released on September 2, 2015. This release is all about date filtering for productions, a cleaner event editor and smarter ticket popups.

Date filters for productions

It has always been possible to filter your event lists by date. Now it is also possible to filter production lists by startdate and endate:

[[wpt_productions start="Monday" end="Friday"]]

You can also group or paginate your production lists by day, month or year:

[[wpt_productions paginateby="month"]]

See the updated documentation for the details.

Event editor clean up

All obsolete elements on the event edit page have been removed, resulting in a much cleaner interface. See the animation below to see the diffenrence:

A clearer event editor - Before/after

Lightbox tweaking

People that like to show their ticketscreens inside a popup can now tweak the behaviour with a little bit of code.

For example, add the code snippet below to the functions.php of your theme to:

  1. set the dimensions of your popup to 1000 x 600 pixels and
  2. disable the popup for screens below a width of 480 pixels.

 

How to link event location to venue website

I received this request on the WordPress.org forum:

Is there a way to assign a link to the “location” field? I’d like to list all events for a specific production on a page and have the “location” field linkable to the theatre address.

By default your events look something like this:

Default event HTML
The default event output where the title and thumbnail link to the production detail page.

Now add the following code to your (child)theme’s functions.php file:

The first parts adds a new ‘Venue URL’ field to the event editor:

Event editor with a Venue URL field

The second part of the code wraps the HTML output of an event location with a link to the venue URL:

The event location now link to the venue website.
The event location now links to the venue website.

Is anyone using it?

Is anyone using it?Do you ever wonder how the Theater for WordPress plugin is used on websites from all over the world? Well, I do.

It is however impossible for me to track usage. The plugin is completely free and can be used anonymously. I therefore started to maintain a showcase page with a list of all implementations that are known to me. People are invited to submit other websites, so the list will hopefully keep growing.

Check it out!

 

Permalinks and new template fields

Theater for WordPress 0.12 was released on July 3, 2015. This release is all about pretty URLs, thumbnails and event dates.

Pretty production links

Choose a custom production base

You can now control what the URLs of your shows, concerts or movies look like. For example:

Go to Settings → Permalinks,  scroll down to Theater permalinks and pick a custom base for your URLs.

More thumbnail sizes

It is now possible to pick which thumbnails size to use in your listings like this:

{{thumbnail('large')}}

You can use any of the predefined sizes (thumbnail, medium, large, full) or add your own with a plugin like Simple Image Sizes:

{{thumbnail('my-custom-size')}}

New date and time placeholders

Is is now possible to show both start and end times in your listing with one of these four new placeholders:

  • {{starttime}}
  • {{startdate}}
  • {{endtime}}
  • {{enddate}}

These placeholder replace the old {{date}} and {{time}}placeholders. They were submitted as a pull request on Github by jbrandligt. Thank you!

Receive updates

[mailchimpsf_form]

 

Replace default divs in event listings

Theater for WordPress wraps all fields inside a <div> element by default. But what if you want to use another element to wrap your field?

For example:

[wpt_events]{{title}}{{excerpt}}{{tickets}}[wpt_events]

outputs:

<div class="wpt_listing wpt_events wpt_events_without_thumbnail">
  <div class="wp_theatre_event">
    <div class="wp_theatre_event_title">My fantastic show</div>
    <p class="wp_theatre_prod_excerpt">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in dictum nisl. Nulla tincidunt vehicula&hellip;</p>
    <div class="wp_theatre_event_tickets"><a href="http://slimndap.com" rel="nofollow" class="wp_theatre_event_tickets_url">Tickets</a></div>
    <span itemscope itemtype="http://data-vocabulary.org/Event">...</span>
  </div>
</div>

Let’s say you want the title to be wrapped in <h1>. You can achieve this with the wpt_event_title_html filter in your theme’s functions.php:

/**
 * Replaces the default divs around the event title in all event listings.
 * 
 * @param string $html The current HTML for the event title.
 * @param WPT_Event $event The current event.
 * @return string The new HTML for the event title.
 */
function replace_event_title_divs($html, $event) {
    return '<h1><a href="'.$event->permalink().'">'.$event->title().'</a></h1>';
}
add_filter('wpt_event_title_html','replace_event_title_divs', 10, 2);

You can do the same with the other fields of an event by replacing title with the name of that field.

Custom fields

Custom fields work a bit different. If you added a custom field address to your events, the filter syntax is like this:

/**
 * Replaces the default divs around the event address in all event listings.
 *
 * @param string $html The current HTML for the event custom field.
 * @param string $field The name of the current custom field.
 * @param WPT_Event $event The current event.
 * @return string The new HTML for the event custom field.
 */
function replace_event_address_divs($html, $field, $event) {
  return '<div class="address">'.$event->custom('address').'</div>';
}
add_filter('wpt_event_address_html','replace_event_address_divs', 10, 3);

Source File

The filters mentioned in this article are located in functions/wpt_event.php.