Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
Created October 20, 2016 17:49
Show Gist options
  • Save GeoffEW/0535375b9315376b0c13cb8722d7434f to your computer and use it in GitHub Desktop.
Save GeoffEW/0535375b9315376b0c13cb8722d7434f to your computer and use it in GitHub Desktop.
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;
// bail if not single event page or if it's not a recurring event instance
if ( !is_singular( Tribe__Events__Main::POSTTYPE ) || $post->post_parent == 0 ) return false;
// remove the tickets form for recurring instances
remove_action( 'tribe_events_single_event_after_the_meta', array( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'front_end_tickets_form' ), 5 );
}
add_action ( 'wp' , 'tribe_remove_tickets_from_recurring_instances' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment