Skip to content

Instantly share code, notes, and snippets.

@vicskf
vicskf / single-event.php
Created February 9, 2018 19:49
TEC > List View, Single Event > Show venue name without link
<?php
/**
* List View Single Event
* This file contains one event in the list view
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/list/single-event.php
*
* @version 4.6.3
*
*/
@vicskf
vicskf / tickets.php
Created January 24, 2018 14:09
Event Tickets Plus > Purchase limit > Workaround for purchase limit not working [98006]
<?php
/**
* Renders the WooCommerce tickets table/form
*
* Override this template in your own theme by creating a file at:
*
* [your-theme]/tribe-events/wootickets/tickets.php
*
* @version 4.6.2
*
@vicskf
vicskf / email.php
Last active June 4, 2018 16:05
Event Tickets > Tickets Email Template override > Adds ticket description to ticket email
<?php
/**
* Tickets Email Template
* The template for the email with the purchased tickets when using ticketing plugins (Like WooTickets)
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/tickets/email.php
*
* This file is being included in events/lib/tickets/Tickets.php
* in the function generate_tickets_email_content. That function has a $tickets
* array with elements that have this fields:
@vicskf
vicskf / functions.php
Created December 27, 2017 14:21
TEC Event Aggregator > Assign a category based on event title
<?php
/*
* When running imports with Event Aggregator it assigns a category depending on event title.
* Works upon inserting and updating events.
*/
add_filter ( 'tribe_aggregator_before_insert_event', 'tribe_aggregator_custom_event_categories' );
add_filter ( 'tribe_aggregator_before_update_event', 'tribe_aggregator_custom_event_categories' );
function tribe_aggregator_custom_event_categories ( $event ) {
$event_title = $event['post_title'];
@vicskf
vicskf / tickets-plus-disable-tax.php
Created December 5, 2017 21:21 — forked from jesseeproductions/tickets-plus-disable-tax.php
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' );
}
@vicskf
vicskf / create-venue-fields.php
Last active December 6, 2017 02:43
TEC Community Events > Sets a default venue country to United States to all the venues created using the Community Event Submission form
<?php
global $post;
$post_id = Tribe__Events__Main::postIdHelper();
$is_auto_draft = get_post_status( $post_id ) === 'auto-draft';
// If not $_POST and if this is not an auto-draft then get the current values to edit
if ( ! $_POST && ! $is_auto_draft ) {
$venue_name = tribe_get_venue();
@vicskf
vicskf / functions.php
Created October 19, 2017 13:43
Events Calendar PRO > Use today as the start of the week for the This Week widget
<?php
/**
* Use today as the start of the week for the This Week widget.
*
* @param $instance
* @param $widget
*
* @return mixed
* @author Barry Hughes
@vicskf
vicskf / functions.php
Last active October 19, 2017 03:29
Event Tickets Plus > Adds different custom message to order emails depending on order items
<?php
/**
* Adds different custom message to order emails depending on order items
* @author Victor Zarranz
*/
add_action( 'woocommerce_email_order_details', 'add_custom_message', 10, 1 );
function add_custom_message( $order ) {
$wootix = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
$items = $order->get_items();
@vicskf
vicskf / functions.php
Created October 5, 2017 13:33
The Events Calendar > Defines alternative title for recurring event views
<?php
/**
* Defines alternative title for recurring event views.
* Based on: https://theeventscalendar.com/knowledgebase/changing-the-browser-title-for-calendar-views/
*
* @param string $title
* @return string
*/
function filter_events_title( $title ) {
@vicskf
vicskf / functions.php
Last active June 12, 2023 16:30
Event Tickets > Send a copy of the RSVP or ticket email to all event organizers that have a valid email address
<?php
/**
* BCC event organizers email on all Event Tickets' RSVP and commerce ticket emails so they get a copy of it too
*/
function bcc_all_event_organizers( $headers, $event_id, $order_id ) {
//check if has organizer
if ( !tribe_has_organizer( $event_id ) ) {
return $headers;
}