Skip to content

Instantly share code, notes, and snippets.

Barry Hughes barryhughes

Block or report user

Report or block barryhughes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@barryhughes
barryhughes / override-min-max-coords.php
Created Aug 8, 2018
Sample of overriding the min/max map view coords (ECP 4.4.30)
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,
@barryhughes
barryhughes / modifiy-multiday-event-tooltips.php
Created Aug 7, 2018
Alter the date presented within month view tooltips for multiday events.
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. in line 3.
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
@barryhughes
barryhughes / remove-rsvp-ticket-form.php
Last active May 18, 2018
Remove RSVP ticket form from single events/posts, via code that can be added to a theme's functions.php file (where that's appropriate)
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
@barryhughes
barryhughes / experimental-smart-month-search.php
Created May 17, 2018
Improve month view search so it is not restricted to the current month. Experimental! Use at own risk, there are known bugs/quirks with this code.
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 {
@barryhughes
barryhughes / add-post-date-column-to-events-wp-list-table.php
Created May 4, 2018
Add post date column to the events WP List Table (TEC 4.x)
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;
}
@barryhughes
barryhughes / remove-mini-cal-list-limits.php
Created May 4, 2018
Allows the list of events below the mini calendar widget to include events from future months, if there are none (or not enough) in the current month
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' );
}
@barryhughes
barryhughes / remove-featured-events.php
Created May 3, 2018
Removes featured events from event queries, unless the query is specifically for featured events
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 ) {
View soft-limit-community-events-title-length.php
<?php
/**
* Adds some JS to enforce a limit on the length of the submitted title.
*
* Modify the limit value (`var limit = 65`) according to your needs, etc.
* Remember that this is frontend only, nothing is enforced server side.
*
* Tested with Community Events 4.5.9.
*/
add_action( 'tribe_events_community_form', function() {
You can’t perform that action at this time.