Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
GeoffEW / nextrecurrence.php
Created October 7, 2016 01:32
Retrieves the next upcoming recurrence for a given post ID
<?php
/**
* Retrieves the next upcoming recurrence for a given post ID
*
* @param int $event_id The post ID for the event
*
* @return WP_Post|null The event post object, or null if nothing was found
*/
function tribe_get_next_upcoming_recurrence( $event_id ) {
@GeoffEW
GeoffEW / addpricetocsv.php
Created October 6, 2016 18:05
Add price to CSV export
<?php
/* Tribe, add price to ticket in CSV export */
function tribe_add_price_to_ticket ( $value, $item, $column ) {
if ( 'ticket' != $column ) return $value;
$product = wc_get_product ($item['product_id']);
return $value . ' - Price: $' . $product->price;
}
@GeoffEW
GeoffEW / tickettoproducts.php
Created October 3, 2016 13:28
Enable tickets to added to products
<?php
/* Tribe, allow products to be an option to add ticket to in 'Events > Tickets > Settings' */
/* WARNING: this brought issues to customers in the past, so activate at your own risk */
if ( class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main') ) {
remove_filter( 'tribe_tickets_settings_post_types', array( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'exclude_product_post_type' ) );
}
@GeoffEW
GeoffEW / prevent_email.php
Created September 29, 2016 03:47
tribe__prevent_woo_tickets_email_to_be_sent
<?php
/* Tribe, prevent woo tickets email to be sent */
add_filter( 'wootickets-tickets-email-enabled', '__return_false' );
<?php
if ( class_exists('Tribe__Events__Pro__Mini_Calendar') ) {
function tribe_fix_minicalendar_hide_from_listing_conflict ( $query ) {
if ( has_action( 'pre_get_posts', array( Tribe__Events__Pro__Mini_Calendar::instance(), 'set_count' ) ) ) {
$query->query_vars['eventDisplay'] = 'list';
remove_action( 'pre_get_posts', 'tribe_fix_minicalendar_hide_from_listing_conflict');
}
<?php
/**
* Event Submission Form Ticket Block
* Renders the ticket settings in the submission form.
*
* Override this template in your own theme by creating a file at
* [your-theme]/tribe-events/community-tickets/modules/tickets.php
*
* @version 4.1
* @package Tribe__Events__Community__Tickets__Main
/* Tribe, insert event website ask enrol link before event content */
function tribe_enrol_link ( ){
$website = tribe_get_event_website_url( );
// bail if no website
if ( empty( $website ) ) return false;
echo '<a href="' . esc_attr( $website ) . '" class="tilmeldbutton" target="_blank">TILMELD</a>';
}
<?php
/* Tribe, force event, venue & organizer websites to open in a new window */
add_filter( 'tribe_get_event_website_link_target', function () { return '_blank'; } );
add_filter( 'tribe_get_venue_website_link_target', function () { return '_blank'; } );
add_filter( 'tribe_get_organizer_website_link_target', function () { return '_blank'; } );
<?php
/*
* The Events Calendar Pro - Hide Mini Calendar Event List Until Calendar Date is Clicked
* TEC PRO @3.11.1
*/
add_action( 'wp_footer', 'tribe_hide_mini_calendar_list_until_clicked', 50 );
function tribe_hide_mini_calendar_list_until_clicked() {
?>
<script>
var $ = jQuery.noConflict();