Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
GeoffEW / alternate_autocomplete_trigger.php
Created January 12, 2017 05:17
Should restore behaviour similar to the original snippet provided by Woo themselves
<?php
function etp_woo_use_alternate_autocomplete_trigger() {
if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
return;
}
$woo_provider = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_action( 'woocommerce_payment_successful_result', array( $woo_provider, 'maybe_complete_order' ) );
@GeoffEW
GeoffEW / details_with_recurrence_info.php
Created November 16, 2016 06:41
Add recurring rules to the details section
<?php
<?php
/**
* Single Event Meta (Details) Template
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe-events/modules/meta/details.php
*
* @package TribeEventsCalendar
*/
@GeoffEW
GeoffEW / ninja_attendee_fix.php
Created November 7, 2016 23:22
Disable Ninja Forms on the The Events Calendar Attendees page. Fixes bug where Ninja Forms overrides the attendee list.
<? php
/**
* Disable Ninja Forms on the The Events Calendar Attendees page.
*
* Fixes bug where Ninja Forms overrides the attendee list.
*/
if( is_admin() && ! empty( $_GET['page'] ) && 'tickets-attendees' === $_GET['page'] ) {
remove_action( 'admin_init', array( Ninja_Forms::instance()->menus[ 'forms' ], 'admin_init' ) );
}
@GeoffEW
GeoffEW / remove_free.php
Created November 1, 2016 04:50
The Events Calendar - Make code empty if it's 0 or Free
<?php
/*
* The Events Calendar - Make code empty if it's 0 or Free
*/
add_filter ( 'tribe_get_cost', 'tribe_not_show_free', 10, 3 );
function tribe_not_show_free ( $cost, $post_id, $with_currency_symbol ) {
if ( $cost == 0 || $cost == 'Free' ) {
$cost = '';
@GeoffEW
GeoffEW / mobile_yoast_view.php
Created October 28, 2016 22:36
Allows mobile view default setting to work alongside Yoast SEO
<?php add_filter( 'wpseo_canonical', function( $canonical_url ) {
global $wp_query;
return ! empty( $wp_query->tribe_is_event_query ) && wp_is_mobile()
? Tribe__Events__Main::instance()->getLink( tribe_get_mobile_default_view() )
: $canonical_url;
} );
@GeoffEW
GeoffEW / remove_recurring_ticket.php
Created October 20, 2016 17:49
remove tickets form for recurring instances other than the first
<?php
/* Tribe, remove tickets form for recurring instances other than the first */
function tribe_remove_tickets_from_recurring_instances ( ) {
global $post;
// bail if The Events Calendar or Event Tickets Plus are not active
if ( !class_exists( 'Tribe__Events__Main' ) || !class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main') ) return false;
@GeoffEW
GeoffEW / ticket_header_img.php
Created October 19, 2016 18:18
Adds ticket header image to event
<? php
// Show the ticket header img
if ( ! isset( $ticket_header_img_rendered ) ) {
$img_id = Tribe__Tickets__Tickets_Handler::instance()->get_header_image_id( $ticket->get_event()->ID );
$header_img = wp_get_attachment_image_src( $img_id, 'full' );
if ( ! $header_img ) break;
echo "<img src='{$header_img[0]}' />";
$ticket_header_img_rendered = true;
}
@GeoffEW
GeoffEW / past_events.php
Created October 18, 2016 21:58
Adds past event possibilities to the tribe_events shortcode
<?php function tribe_past_events_shortcode( $atts ) {
if ( ! class_exists( 'Tribe__Events__Pro__Shortcodes__Tribe_Events' ) ) return '';
add_action( 'parse_query', 'tribe_past_events_shortcode_modify_query' );
$shortcode = new Tribe__Events__Pro__Shortcodes__Tribe_Events( $atts );
return $shortcode->output();
}
function tribe_past_events_shortcode_modify_query( $query ) {
$query->set( 'tribe_is_past', true );
remove_action( 'parse_query', 'tribe_past_events_shortcode_modify_query' );
@GeoffEW
GeoffEW / et+loadjupiter.php
Created October 11, 2016 02:16
Fix loading of ET+ files even if page structure changes (e.g. Jupiter theme)
<?php
function tribe_snippet_clean_filename( $filename, $filename_raw ) {
if ( 0 === strpos( $filename, '.' ) && false === strpos( $filename_raw, '.' ) ) {
return substr( $filename, 1 );
}
return $filename;
}
add_filter( 'sanitize_file_name', 'tribe_snippet_clean_filename', 10, 2 );
@GeoffEW
GeoffEW / moveticketinnormalpost.php
Created October 7, 2016 20:24
Moves ticket form in a normal post type (page, post)
<?php
if ( class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main') ) {
// remove default action
remove_filter ( 'the_content', array( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'front_end_tickets_form_in_content' ), 11 );
function custom_front_end_tickets_form_in_content( $content ) {
$woo = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();