Shortcodes

Jeroen Schmit edited this page Jun 11, 2017 · 44 revisions

Theatre comes with several shortcodes that can be used to insert content inside posts and pages.

Event listing

Lists all upcoming events:

[wpt_events]

Arguments

  • paginateby {day, month, year and/or category} Paginate by day, month and/or category. If set a day, month and/or category navigation is added to the top of the listing. Default <empty>.
  • groupby {day, month, year or category} Group by day, month or category. If set a day, month or category header is added at the start of each group. Default <empty>.
  • limit {number} The maximum number of events to show. No maximum when left empty.
  • start {string} A date/time string. Only show events that start after a certain time. See strtotime() for some example values. Default <empty>.
  • end {string} A date/time string. Only show events that end before a certain time. See strtotime() for some example values. Default <empty>.
  • production {int} A comma-seperated list of production post IDs. Only show events that belong to a particular production. Default <empty>.
  • season {number} The ID of a season. Only show events that belong to a production of a particular season. Default <empty>.
  • category_name {string} A comma-seperated list of categorie names (slugs). Only show events that belong to a production within certain categories. Default <emtpy>.
  • cat {int} A comma-seperated list if category IDs. Only show events that belong to a production within certain categories. Use negative category IDs to exclude a category. Default <emtpy>.
  • post__in {int} A comma-seperated list of post IDs. Only show the events with one of the IDs. Default <empty>.
  • post__not_in {int} A comma-seperated list of post IDs. Don't show the events with one of the IDs. Default <empty>.
  • order {asc or desc} Show events in ascending or descending order. Default <asc>.

Template

The event listing uses a template to generate the HTML for each event. The default template is:

{{thumbnail|permalink}} {{title|permalink}} {{remark}} {{datetime}} {{location}} {{tickets}}

It is possible to use your own template by using an enclosing shortcode:

[wpt_events]<h3>{{title}}</h3><p>{{datetime}}}<br />{{location}}</p>[/wpt_events]

Available fields:

  • {{categories}}
  • {{content}}
  • {{datetime}}
  • {{duration}}
  • {{enddate}}
  • {{endtime}}
  • {{excerpt}}
  • {{location}}
  • {{prices}}
  • {{remark}}
  • {{startdate}}
  • {{starttime}}
  • {{thumbnail}}
  • {{tags}}
  • {{tickets}}
  • {{tickets_url}}
  • {{title}}
  • {{venue}}

To turn a field into a link, you can add a permalink filter to the placeholder:

{{title|permalink}}

By default, all dates are formatted using the date format setting in WordPress. To use another format, you can add a date filter to the placeholder:

{{datetime|date('D j')}}

Custom fields

If you added a custom field to the productions then you can also use this a a placeholder. To display a custom 'composer' field:

{{composer}}

More examples

Show all upcoming events, grouped by month:

[wpt_events groupby="month"]

Show all upcoming events, paginated by category:

[wpt_events paginateby="category"]

Show all upcoming events, paginated by category and month:

[wpt_events paginateby="category,month"]

Show all upcoming events, paginated by month and grouped by category:

[wpt_events paginateby="month" groupby="category"]

Show the first 10 upcoming events:

[wpt_events limit="10"]

Show events in the drama and music categories:

[wpt_events category_name="drama,music"]

Exclude all events from category with ID 2:

[wpt_events cat="-2"]

Show all events in September 2014:

[wpt_events start="2014-09" end="2014-10"]

Show all events on September 3rd, 2014:

[wpt_events start="03-09-2014" end="04-09-2014"]

Show all events for today:

[wpt_events start="today" end="tomorrow"]

Show all events for tomorrow:

[wpt_events start="tomorrow" end="tomorrow + 1 day"]

Display only specific upcoming events:

[wpt_events post__in="12,13"]

Display all upcoming events but NOT the specified ones:

[wpt_events post__not_in="12,13"]

Display only upcoming events of a specific production:

[wpt_events production="123"]

Display only upcoming events of specific productions:

[wpt_events production="123,456"]

Production event listing

Lists all upcoming events for a production:

[wpt_production_events]

Can be used on the page of a production.

Template

The event listing uses the same default template and fields as the regular event listing. You can use an enclosing shortcode to add your own template:

[wpt_production_events]{{remark}} {{datetime}} {{location}} {{tickets}}[/wpt_production_events]

Event ticket link

Display the ticket link for an event.

Arguments

  • id The ID of the event.

Example:

[wpt_event_ticket_button id="123"]

Production listing

Lists all productions:

[wpt_productions]

Arguments

  • paginateby {day, month, year, season and/or category} Paginate by month, year, season and/or category. If set, a navigation is added to the top of the listing. Default <empty>.
  • groupby {day, month, year, season or category} Group by day, month, year, season or category. If set, a header is added at the start of each group. Default <empty>.
  • limit {number} The maximum number of productions to show. No maximum when left empty.
  • start {string} A date/time string. Only show productions with events that start after a certain time. See strtotime() for some example values. Default <empty>.
  • end {string} A date/time string. Only show productions with events that end before a certain time. See strtotime() for some example values. Default <empty>.
  • season {number} The ID of a season. Only show productions of a particular season. Default <empty>.
  • category_name {string} A comma-seperated list of categorie names (slugs). Only show productions within certain categories. Default <emtpy>.
  • cat {int} A comma-seperated list of category IDs. Only show productions within certain categories. Use negative category IDs to exclude a category. Default <emtpy>.
  • post__in {int} A comma-seperated list of post IDs. Only show the productions with one of the IDs. Default <empty>.
  • post__not_in {int} A comma-seperated list of post IDs. Don't show the productions with one of the IDs. Default <empty>.
  • order {asc or desc} Show productions in ascending or descending order. Default <asc>.

Template

The event listing uses a template to generate the HTML for each event. The default template is:

{{thumbnail|permalink}} {{title|permalink}} {{dates}} {{cities}}

It is possible to use your own template by using an enclosing shortcode:

[wpt_productions]<h3>{{title}}</h3><p>{{dates}}}<br />{{cities}}</p>[/wpt_productions]

Available fields:

  • {{categories}}
  • {{cities}}
  • {{content}}
  • {{dates}}
  • {{excerpt}}
  • {{prices}}
  • {{tags}}
  • {{thumbnail}}
  • {{title}}
  • {{summary}}

To turn a field into a link, you can add a permalink filter to the placeholder:

{{title|permalink}}

By default, all dates are formatted using the date format setting in WordPress. To use another format, you can add a date filter to the placeholder:

{{datetime|date('D j')}}

Custom fields

If you added a custom field to the productions then you can also use this a a placeholder. To display a custom 'composer' field:

{{composer}}

More examples

Show all upcoming productions:

[wpt_productions start="now"]

Show all productions, grouped by season:

[wpt_productions upcoming groupby="season"]

Show all productions, paginated by season:

[wpt_productions paginateby="season"]

Show all productions, paginated by season and grouped by category:

[wpt_productions paginateby="season" groupby="category"]

Show all upcoming events with the production title and summary:

[wpt_productions fields="title,summary"]

Show the first 10 upcoming productions:

[wpt_productions limit="10"]

Show productions in the drama and music categories:

[wpt_productions category_name="drama,music"]

Display only the specific productions:

[wpt_productions post__in="12,13"]

Display all productions but NOT the specified ones:

[wpt_productions post__not_in="12,13"]

Event calendar

A calendar with all upcoming events:

[wpt_calendar]