Instantly share code, notes, and snippets.

View generate-eventbrite-testing-data-v3api.php
<?php
# Quickly generate a set of test events on Eventbrite.com
# (from within a WordPress environment - useful for setting
# up test scenarios etc).
$token = '--YOUR-TOKEN-HERE--';
$date = date_create( '2019-01-01 12:00:00' );
for ( $i = 0; $i <= 60; $i++ ) {
$date->modify( '+2 days' );
View override-min-max-coords.php
<?php
# Prohibit caching of geoloc center point/bounds
add_filter( 'pre_transient_geoloc_center_point_estimation', '__return_null' );
# Override the min/max coords
add_filter( 'tribe_geoloc_pre_get_min_max_coords', function() {
return [
'min_lat' => 30,
'max_lat' => 40,
'min_lng' => 20,
View modifiy-multiday-event-tooltips.php
<?php
/**
* Modifies the month view tooltip for multiday events.
*
* Instead of seeing "5 - 15 August", the tooltip for multiday event will show
* the date of the cell which contains it.
*
* For example, if a visitor hovers over the multiday event name within the cell
* for 11 August, the tooltip will now display "11 August" etc.
*/
View gigpress-sample-export.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 23 columns, instead of 16.
Date,Time,End date,Artist,Artist URL,Venue,Address,City,State,Postal code,Country,Venue phone,Venue URL,Admittance,Price,Ticket URL,Ticket phone,External URL,Notes,Tour,Status,Related ID,Related URL
2018-10-02,12:00:00,2018-10-05,Jon Bon Jovi,https://www.bonjovi.com/,Party Spot NW,1041 SW Marine Dr,Vancouver,BC,V6P 6L6,CA,,,Not sure,,,,,,,active,0,
2018-08-25,14:00:00,,The Spice Girls,http://thespicegirls.com/,Lakeway Dance Hall,714 Lakeway Dr,Bellingham,WA,98229,US,456-789-0123,http://lakeway.site.web,All Ages/Licensed,"¥2,225.00",,01222 333444,,"A rare treat with beef ribs jowl officia corned beef ad. Sed in culpa dolore irure corned beef shoulder nostrud cupidatat swine.
Dolore ullamco minim short loin short ribs cillum. Beef ham short loin strip steak in. Laboris biltong do filet mignon veniam drumstick.",,active,0,
2018-07-17,07:30:00,,Anna Carina,http://www.annacarina.net/,Chalkpit at Cedar City,1575 W 200 N,Cedar City,UT,84720,US,(1) 234 567 8901,,All Ages/Licensed,$25,http://some.tickets/getem/j
View remove-rsvp-ticket-form.php
<?php
// This code can be added to a theme's functions.php file to remove
// the frontend ticket form (RSVPs only)
if ( function_exists( 'tribe' ) && class_exists( 'Tribe__Tickets__RSVP' ) ) {
// Remove the RSVP ticket form from blog posts, etc
remove_filter( 'the_content', array(
tribe( 'tickets.rsvp' ), 'front_end_tickets_form_in_content'
), 11 );
// Remove the RSVP ticket form from single event posts
View experimental-smart-month-search.php
<?php
/**
* If a search is conducted in month view but the relevant events
* are in a different month, switch to that month.
*
* Experimental! Especially during live ajax navigation, there are
* parts of this that don't work cleanly (pushstate/URL changes).
* Unsupported, use at own risk.
*/
class Transmogrified_Month_View_Search {
View add-post-date-column-to-events-wp-list-table.php
<?php
function events_post_date_column( $column_id, $post_id ) {
echo 'post_date' === $column_id ? get_the_date( '', $post_id ) : '';
}
function events_post_date_column_header( $headers ) {
$headers['post_date'] = 'Post Date';
return $headers;
}
View remove-mini-cal-list-limits.php
<?php
function remove_mini_cal_list_end_date( $query ) {
remove_action( 'tribe_events_pre_get_posts', 'remove_mini_cal_list_end_date' );
$query->set( 'end_date', '' );
}
function listen_for_mini_cal_list( $template_file ) {
if ( basename( dirname( $template_file ) ) . '/' . basename( $template_file ) == 'mini-calendar/list.php' ) {
add_action( 'tribe_events_pre_get_posts', 'remove_mini_cal_list_end_date' );
}
View remove-featured-events.php
View etp-wc-conditionally-unset-payment-option.php
<?php
/**
* Unset the cheque payment option if any of the existing cart items happen to
* be a ticket for an event which belongs to a specific category.
*
* @param array $available_gateways
*
* @return array
*/
function maybe_unset_gateway_by_category( $available_gateways ) {