Skip to content

Instantly share code, notes, and snippets.

@jesseeproductions
jesseeproductions / tribe-ticket-description-email.php
Last active December 20, 2017 01:58
Event Tickets - Ticket Description in Ticket Email for WooCommerce Tickets
//Add inside the foreach ( $tickets as $ticket ) { }
$ticket_product_id = get_post_meta( $ticket['ticket_id'], '_tribe_wooticket_product', true );
$ticket_product = get_post( $ticket_product_id );
$ticket_description = $ticket_product->post_excerpt;
//Add inside ticket html:
<table class="ticket-details" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
@jesseeproductions
jesseeproductions / tribe-tickets-plus-prevent-emails.php
Created January 26, 2016 16:08
Events Tickets Plus - WooCommerce Tickets - Prevent Ticket Email from being sent.
/*
* Events Tickets Plus - WooCommerce Tickets - Prevent Ticket Email from being sent.
* @ Version 4.0
*/
add_action( 'init', 'wootickets_stop_sending_email' );
function wootickets_stop_sending_email() {
if ( class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
$woo = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'woocommerce_email_classes', array( $woo, 'add_email_class_to_woocommerce' ) );
add_action( 'woocommerce_email_after_order_table', array( $woo, 'add_tickets_msg_to_email' ) );
@cliffordp
cliffordp / functions.php
Created February 15, 2016 16:54
In month view, display all-day events below non-all-day events in each individual day cell.
<?php
/**
* In month view, display all-day events below non-all-day events in each individual day cell.
*
* Barry wrote it 2016-02-15
* https://gist.github.com/cliffordp/fc9b2df3c4d7cf062fde
*
* See https://gist.github.com/cliffordp/4a273f419457d8862bb0 for similar customization but for recurring events
*
* Uses two PHP anonymous functions so only compatible with PHP 5.3+
@jesseeproductions
jesseeproductions / tickets-plus-disable-tax.php
Created March 2, 2016 13:51
Event Tickets Plus - Disable Taxes for Ticket Products
/**
* Event Tickets Plus - Disable Taxes for Ticket Products
*/
add_action( 'wootickets_after_save_ticket', 'tribe_disable_taxes_ticket_product' );
function tribe_disable_taxes_ticket_product( $ticket_id ) {
update_post_meta( $ticket_id, '_tax_status', 'none' );
update_post_meta( $ticket_id, '_tax_class', 'zero-rate' );
}
@elimn
elimn / tribe_prevent_add_cart_empty.php
Created April 29, 2016 20:22
MT | ET | Force users to select at least one ticket or RSVP before submitting the form
<?php
/*
* Prevents users from adding tickets to cart unless they have selected at least one ticket
*/
function tribe_prevent_add_cart_empty() {
echo '
<script type="text/javascript">
jQuery( document ).ready(function(){
jQuery( "form.cart" ).each(function(){
@elimn
elimn / Tribe__Events__Filterbar__Filters__Time_Of_Day.php
Last active December 5, 2017 05:17
MT | TEC | Custom Time of Day Filter
<?php
/**
* Customized version of the Time of Day filter that allows selecting by specific hour ranges in the afternoon
* New filter available in WP-Admin > Events > Settings > Filters
*/
if ( class_exists( 'Tribe__Events__Filterbar__Filter' ) ) {
class Tribe__Events__Filterbar__Filters__Time_Of_Day_Custom extends Tribe__Events__Filterbar__Filter {
public $type = 'checkbox';
@cliffordp
cliffordp / functions.php
Last active September 13, 2017 03:36
Recurring events in wp-admin: only display first (parent) occurrence in list of Events (i.e. hide child recurring events)
<?php
/*
* Recurring events in wp-admin: only display first (parent) occurrence in list of Events
* (i.e. hide child recurring events)
*
* From https://theeventscalendar.com/knowledgebase/hide-recurring-event-instances-in-admin/
* - https://gist.github.com/cliffordp/81f23a207ab483c9e7c6d910f9b29c0a
* 2016-07-04 Barry shared this snippet from a previous customer's own/shared customization
*
@GeoffEW
GeoffEW / force_cost.php
Created July 27, 2016 17:24
/* Force the use of the cost field of event and ignore tickets price */
<?php
/* Force the use of the cost field of event and ignore tickets price */
function tribe_just_show_price_field ( $cost, $post_id, $with_currency_symbol ) {
$cost_utils = Tribe__Events__Cost_Utils::instance();
$cost = tribe_get_event_meta( $post_id, '_EventCost' );
if ( $with_currency_symbol ) {
$cost = $cost_utils->maybe_format_with_currency( $cost );
@elimn
elimn / tribe_embed_google_map_true.php
Created August 2, 2016 04:59
MT | TEC | Always show Google Map and Map Link on Single Events
<?php
/**
* Causes calendar to always show Google Map and Link, regardless of individual event settings
*/
add_filter( 'tribe_embed_google_map', '__return_true' );
add_filter( 'tribe_show_google_map_link', '__return_true' );
@GeoffEW
GeoffEW / change_rsvp_label_CT.php
Created August 10, 2016 21:29
Replaces label for RSVP tickets in the radio button selector in the Community Tickets front-end "Add ticket" interface
<?php
function change_rsvp_label() { ?>
<script>
jQuery(document).ready( function ( ){
jQuery('input[value="Tribe__Tickets__RSVP"]').next().html('Free Tickets');