Skip to content

Instantly share code, notes, and snippets.

@elimn
elimn / tribe_filter_ticket_providers.php
Created February 14, 2017 18:11
MT | ET | Hide tickets option in Community Events from anonymous users
<?php
/**
* Removes ticket providers except those specified in $enabled_providers
*/
function tribe_filter_ticket_providers() {
// This contains the list of provider we will allow
$enabled_providers = array(
'Tribe__Tickets__RSVP',
);
@elimn
elimn / tribe_custom_qr_example.php
Created February 14, 2017 08:01
MT | ET | Override the QR code look for Event Tickets Plus 4.4
<?php
/**
* An example for overriding the QR code look for Event Tickets Plus 4.4
*/
class Tribe_Custom_QR_Example {
public function replace_existing() {
remove_action( 'tribe_tickets_ticket_email_ticket_bottom', array( Tribe__Tickets_Plus__Main::instance()->qr(), 'inject_qr' ) );
add_action( 'tribe_tickets_ticket_email_ticket_bottom', array( $this, 'inject_qr' ) );
@elimn
elimn / tribe_remove_single_calendar_links.php
Created February 14, 2017 07:39
MT | TEC | Remove the iCal and Google cal links from the single event page
@elimn
elimn / tribe_remove_customizer_css.php
Last active July 2, 2019 07:56
MT | TEC | Remove the Tribe Customier css <script> from footer
<?php
/**
* Remove the Tribe Customier css <script>
*/
function tribe_remove_customizer_css(){
if ( class_exists( 'Tribe__Customizer' ) ) {
remove_action( 'wp_print_footer_scripts', array( Tribe__Customizer::instance(), 'print_css_template' ), 15 );
}
}
@elimn
elimn / tribe_remove_recurring_feed.php
Created January 24, 2017 04:52
MT | TEC | Remove link to a recurring event's RSS feed from the <head>
<?php
/**
* Removes link to a recurring event's RSS feed from the <head>
*/
function tribe_remove_recurring_feed() {
if ( tribe_is_recurring_event() ) {
remove_action( 'wp_head', 'feed_links_extra', 3 );
}
}
@elimn
elimn / tribe_remove_anonymous_hook.php
Last active January 23, 2017 16:15
MT | Remove filter or action added by an anonymous object
<?php
if ( ! function_exists( 'tribe_remove_anonymous_hook' ) ) {
/**
* Removes a filter or action added by anonymous objects
*
* Use this when you can not get the instance of a class attached to a hook.
* If the given method is attached multiple times to the hook, only one is removed.
*
* Example: tribe_remove_anonymous_hook( 'plugins_loaded', 'Tribe__Class', 'method_name' );
@elimn
elimn / tribe_remove_row_actions.php
Created January 16, 2017 20:58
MT | ET | Remove Tickets row actions from Admin WP tables
<?php
/**
* Remove Tickets row actions from Admin WP tables, except for post_types selected in Settings > Tickets
*/
function tribe_remove_row_actions() {
if ( ! function_exists( 'tribe_get_option' ) ) {
return;
}
@elimn
elimn / tribe_mail.php
Last active December 19, 2016 17:36
MT | Send an email Tribe style
<?php
/**
* Sends an email Tribe style
*
* This will retrieve a template file and use it to populate the content body.
* Defaults to HTML emails.
*
* @param string $email_name Name of this email in snake_case format, used as suffix in apply_filter().
* @param string|array $to Array or comma-separated list of email addresses to send message.
* @param string $subject Email subject.
@elimn
elimn / tribe_remove_assets.php
Last active May 29, 2017 14:16
MT | Common | Example for removing an asset enqueued by Tribe__Assets
<?php
/**
* Example for removing tribe-jquery-ui-theme from being registered
*
* @see https://theeventscalendar.com/extensions/dequeue-assets/
*/
function tribe_remove_assets() {
Tribe__Assets::instance()->remove( 'tribe-jquery-ui-theme' );
}
@elimn
elimn / tribe_call_private_method.php
Last active December 12, 2016 18:55
MT | Function for calling private and protected methods of classes
<?php
if ( ! function_exists( 'tribe_call_private_method' ) ) {
/**
* Calls a private/protected method in any class
*
* Only use this as a last resort. Private methods are not intended to
* be accessed, and can change functionality on any update.
*
* To call Tribe__Class::instance()->set_something( $var1, $var2 ) do this: