Skip to content

Instantly share code, notes, and snippets.

Jeroen Schmit slimndap

View GitHub Profile
@slimndap
slimndap / wp-theatre-venue-city-filter.php
Last active Aug 29, 2015
Adds venue and city filters to event listings. Eg. [wpt_events venue="Ritz" city="El paso"]. For a full explanation see: http://www.slimndap.com/add-venue-and-city-filters-to-event-listings/.
View wp-theatre-venue-city-filter.php
/**
* Adds venue and city filters to the default options for event listings.
*
* @param array $defaults The current defaults.
* @return array The defaults with venue and city added.
*/
function add_venue_filter_to_events($defaults) {
$defaults['venue'] = false;
$defaults['city'] = false;
return $defaults;
@slimndap
slimndap / wp-theatre-add-doors-open-field.php
Created Jun 24, 2015
Adds a new 'Doors open' field to the event editor. For a more information see: http://www.slimndap.com/a-new-event-editor/.
View wp-theatre-add-doors-open-field.php
/**
* Adds a 'Doors open' field to the event editor.
*
* Prepends the new field by filtering the current fields of the event editor
* using the 'wpt/event_editor/fields' hook.
*
* @param array $fields The current fields of the event editor.
* @param int $event_id The ID of the event being edited.
* @return array The new fields of the event editor.
*/
@slimndap
slimndap / wp-theatre-remove-event-editor-fields.php
Last active Aug 29, 2015
Removes 'End time' and all tickets field from the event editor.
View wp-theatre-remove-event-editor-fields.php
/**
* Removes 'End time' and all tickets fields from the event editor.
*
* @param array $fields The current fields of the event editor.
* @param int $event_id The event being edited.
* @return array The new fields of the event editor.
*/
function remove_event_editor_fields($fields, $event_id) {
$new_fields = array();
@slimndap
slimndap / wp-theatre-show-production-events-dates-prices.php
Created Jul 6, 2015
Show dates and prices for the events of a production. Place this code inside your template (eg. single.php or sidebar.php) at the position that you would like the dates and prices to appear.
View wp-theatre-show-production-events-dates-prices.php
/*
* Show dates and prices for the events of this production.
*/
if ( is_singular( 'wp_theatre_prod' ) ) {
$production = new WPT_Production();
echo '<ul>';
foreach ( $production->events() as $event ) {
echo '<li>'.$event->startdate_html().$event->prices_html().'</li>';
}
@slimndap
slimndap / theater-012-demo.css
Last active Aug 29, 2015
The CSS for the Theater v0.12 demo.
View theater-012-demo.css
.wpt_listing .wp_theatre_event .theater-012-demo {
position: relative;
margin: 0;
}
.wpt_listing .wp_theatre_event .theater-012-demo .event-info {
bottom: 0;
background-color: rgba(0, 0, 0, 0.2);
color: #fff;
width: 100%;
padding: 10px;
@slimndap
slimndap / wp-theatre-remove-enclogins-divs-from-date-and-time.php
Created Jul 28, 2015
Remove the enclosing divs from the HTML of the event startdate, starttime, enddate and endtime.
View wp-theatre-remove-enclogins-divs-from-date-and-time.php
<?php
/**
* Removes the enclosing div from the event startdate HTML.
*
* @param string $html The HTML.
* @param array $filters The template filters.
* @param WPT_Event $event The event.
* @return string The HTML without enclosing divs.
*/
function wpt_remove_startdate_divs($html, $filters, $event) {
@slimndap
slimndap / wpt_event_editor_add_venue_url.php
Last active Aug 29, 2015
Adds a link to the venue to the location HTML output. See http://theater.slimndap.com/link-the-event-location-to-the-venue-website/ for the full article.
View wpt_event_editor_add_venue_url.php
<?php
/**
* Adds a new 'Venue URL' field to the event editor.
*
* @param array $fields The current fields of the event editor.
* @return array The new fields of the event editor.
*/
function wpt_event_editor_add_venue_url_field($fields) {
$new_fields = array();
foreach($fields as $field) {
@slimndap
slimndap / wpt_escape_from_iframe.js
Created Aug 12, 2015
Prevent your users from getting stuck inside the tickets iframe/lightbox when they return from the ActiveTickets screens.
View wpt_escape_from_iframe.js
/* escape from iframe, when returning from ActiveTickets */
if (window.self !== window.top) {
top.location.href = location.href;
}
@slimndap
slimndap / wpt_activetickets_subtitle_field.php
Last active Aug 29, 2015
An example of how to import custom fields (in this case a subtitle) during with the ActiveTickets import, using the Theater for Wordpress plugin. You can show the subtitle in your listings like this: `[wpt_events]{{title|permalink}}{{subtitle}}[/wpt_events].
View wpt_activetickets_subtitle_field.php
<?php
/**
* Adds the subtitle ActiveTickets field to a production on import.
*
* You can show the subtitle in your listings like this:
* [wpt_events]{{title|permalink}}{{subtitle}}[/wpt_events]
*
* You can add the subtitle to your template like this:
* $production = new WPT_Production();
@slimndap
slimndap / wpt_change_events_on_production_page_header.php
Created Sep 2, 2015
Changes the default Events header on the production details page.
View wpt_change_events_on_production_page_header.php
<?php
/**
* Changes the default Events header on the production details page.
*
* @param string $header The default Events header.
* @return string The new Events header.
*/
function wpt_change_events_on_production_page_header($header) {
return '<h4>Showtimes</h4>';
}
You can’t perform that action at this time.