Skip to content

Instantly share code, notes, and snippets.

Avatar

Barry Hughes barryhughes

View GitHub Profile
View gist:9746674

Team 8 Concession Duty

No volunteers yet!

We have been asked to cover 12.10pm - 1.20pm on March 29 (so the times have since changed, originally we were to provide volunteers later in the afternoon).

Contact me by email / add a comment if you are available to help out.

@barryhughes
barryhughes / gist:bae73fd5489be6a676cf
Created May 23, 2014
Replacing the existing date filter (Tribe Bar/3.5)
View gist:bae73fd5489be6a676cf
<?php
/**
* Outline for replacing the existing datepicker with a custom filter field.
*
* (TEC 3.5)
*/
add_action( 'init', 'replace_tribe_bar_search_field', 50 );
function replace_tribe_bar_search_field() {
$callback = array( TribeEvents::instance(), 'setup_date_search_in_bar' );
@barryhughes
barryhughes / gist:31f3941071ea54b102c5
Created Jun 19, 2014
Quick hack to remove "Upcoming Events >" (photo view/category applied/TEC 3.6.x)
View gist:31f3941071ea54b102c5
<?php
add_action( 'tribe_pre_get_view', 'occassionally_kill_pro_title_filter' );
function occassionally_kill_pro_title_filter() {
remove_action( 'tribe_pre_get_view', 'occassionally_kill_pro_title_filter' );
if ( ! tribe_is_photo() ) return; // You could extend or further limit when this runs
remove_filter( 'tribe_get_events_title', array( TribeEventsPro::instance(), 'reset_page_title'));
add_filter( 'tribe_get_events_title', 'modify_events_title' );
}
View Eventbrite Ticket form positioning.php
<?php
/**
* Change the position of the Eventbrite Tickets ticket form (within single event pages).
*/
function change_eventbrite_ticket_position() {
// Do nothing if Eventbrite Tickets is not active
if ( ! class_exists( 'Event_Tickets_PRO' ) ) return;
// Get a reference to the callback method responsible for displaying the ticket form
$display_tickets = array( Event_Tickets_PRO::instance(), 'print_ticket_form' );
@barryhughes
barryhughes / gunzipstring.php
Last active Aug 29, 2015
Write a string to a temp file, gunzip it, clean up the temp files and return the decompressed string
View gunzipstring.php
<?php
use Exception,
Zend\Filter\Decompress;
/**
* The gzip adapter for Zend's decompression filter doesn't always
* operate reliably on strings. This utility class transparently writes
* the string to a temp file and then passes it through the filter.
*
@barryhughes
barryhughes / fix-31895.php
Created Nov 11, 2014
Helper for customizations relying on front page pagination hack
View fix-31895.php
<?php
/**
* Workaround for themes, plugins and customizations that rely on
* redirect_canonical() *not* redirecting when pagination is used
* on a static front page.
*/
add_action( 'init', 'modify_pro_canonical_filter' );
function modify_pro_canonical_filter() {
if ( ! class_exists( 'TribeEventsPro' ) ) return;
@barryhughes
barryhughes / wp-unhook-anonymous-obj-methods.php
Created Nov 25, 2014
Unhook actions/filters belonging to anonymous objects
View wp-unhook-anonymous-obj-methods.php
<?php
/**
* Sample approach for removing action/filter functions belonging
* to anonymous objects.
*/
function remove_anonymous_objects_from_wp_hooks() {
global $wp_filter;
// Specific hooks and priorities we want to search
$hooks = [
@barryhughes
barryhughes / public_attendee_list.php
Created Nov 26, 2014
Registers a [public_attendee_list] shortcode. Should work with The Events Calendar + WooCommerce Tickets (or any of the other related ticketing addons). Simply drop the shortcode into the event description and it will *publicly* list how many folks are attending etc... tweak to make it fit your own needs! You may for instance wish to add a check…
View public_attendee_list.php
<?php
/**
* Generates output for the [public_attendee_list] shortcode.
*
* Assumes we're interested in the current event or, optionally, a specific
* event ID can be provided:
*
* [public_attendee_list id="789"]
*
* This is a rudimentary starting point only! Please assess and tweak to
@barryhughes
barryhughes / nav.php
Created Nov 26, 2014
Template override for list/nav.php (TEC 3.8.x) - tests possible efficiency savings in list view pagination
View nav.php
<?php
/**
* List view nav template (making use of alternative pagination functions)
*
* This template isn't really the proper place for the two template definitions included
* at the top, but they could easily be moved to a more suitable location. They've been
* included in this file for no reason other than ease of demonstrating and sharing a
* workaround.
*/
defined( 'ABSPATH' ) or exit( '-1' );
@barryhughes
barryhughes / workaround-edd-print-tickets.php
Created Dec 4, 2014
Fix a temp issue between EDD Tickets 3.8 and EDD 2.1.9. Please place in your theme's functions.php file (or another suitable location) but be sure to remove the leading <?php tag as appropriate.
View workaround-edd-print-tickets.php
class Tribe_EDDTickets_Fix31092 {
/**
* Override EDDTickets' own print_ticket_url() callback.
*/
public function __construct() {
add_filter( 'edd_download_file_url_args', array( $this, 'print_ticket_url' ), 20 );
}
/**
* @param $item
You can’t perform that action at this time.