Skip to content

Instantly share code, notes, and snippets.

@theeventscalendar
theeventscalendar / EventWebsiteLink2.php
Last active December 28, 2020 13:22 — forked from barryhughes/EventWebsiteLink.php
Make an Event Website a link instead of showing the text url. This version opens a new window with the additional target=blank code.
<?php
add_filter( 'tribe_get_event_website_link_label', 'tribe_get_event_website_link_label_default' );
function tribe_get_event_website_link_label_default( $label ) {
if ( $label === tribe_get_event_website_url() ) {
$label = "Visit Website &raquo;";
}
return '<a href="' . tribe_get_event_website_url() . '" target="_blank">' . $label . '</a>';
}
@theeventscalendar
theeventscalendar / ticketsplus_woocommerce-products.php
Last active February 15, 2022 22:38 — forked from elimn/tribe_wootix_no_hijack.php
Allows customers to access the WooCommerce product page for tickets with Tickets Plus
<?php
/*
* Causes WooCommerce Ticket product pages to stop redirecting to their event page
* See https://theeventscalendar.com/knowledgebase/selling-tickets-from-the-woocommerce-products-page/
*/
function tribe_wootix_no_hijack() {
if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) return;
$woo_tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'post_type_link', array( $woo_tickets, 'hijack_ticket_link' ), 10, 4 );
@theeventscalendar
theeventscalendar / link_to_fb_event.php
Last active November 19, 2015 17:07 — forked from elimn/tribe_link_to_fb_event.php
Add a link to the original Facebook event from an imported event listing
@theeventscalendar
theeventscalendar / woo-disable-ticket-email
Last active November 14, 2015 00:44
WooCommerce Tickets 3.12.1 // Disable ticket email from sending
/**
Plugin Name: WooCommerce Tickets: Disable Ticket Emails
Description: Turns off ticket emails that are automatically sent from WooCommerce Tickets
Version: 1.0
**/
function wootickets_email_no_no() {
return 'no';
}
@theeventscalendar
theeventscalendar / add-category-to-title.php
Created September 18, 2015 21:21 — forked from elimn/functions.php
Add category name(s) to event title
<?php
// Prepends category name(s) to the event titles
function tribe_events_title_include_cat ($title, $id) {
$separator = ' &raquo; '; // HTML Separator between categories and title
$cats = get_the_terms($id, 'tribe_events_cat');
$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
$is_truly_admin = is_admin() && !$is_ajax;
@theeventscalendar
theeventscalendar / set-ticket-default.php
Created September 18, 2015 21:18 — forked from anonymous/segment__tickets.php
Set a default quantity in the Ticket form
woocommerce_quantity_input( array(
'input_name' => 'quantity_' . $ticket->ID,
'input_value' => 0,
'min_value' => 0,
'max_value' => $max_quantity,
) );
@theeventscalendar
theeventscalendar / add-event-title.php
Last active July 3, 2023 22:47 — forked from geoffgraham/gist:145f929f4547bb2c690e
Add event title to cart next to ticket name
<?php
/**
* Example for adding event data to WooCommerce checkout for Events Calendar tickets.
* @link http://theeventscalendar.com/support/forums/topic/event-title-and-date-in-cart/
*/
add_filter( 'woocommerce_cart_item_name', 'woocommerce_cart_item_name_event_title', 10, 3 );
function woocommerce_cart_item_name_event_title( $title, $values, $cart_item_key ) {
$ticket_meta = get_post_meta( $values['product_id'] );
$event_id = absint( $ticket_meta['_tribe_wooticket_for_event'][0] );
@theeventscalendar
theeventscalendar / event_limit_list_widget.txt
Last active September 17, 2015 21:46 — forked from geoffgraham/gist:f28a14fb13796ccecf39
Increase the number of events in the Advanced List Widget. See http://m.tri.be/18iv.
add_filter('widget_display_callback', 'increase_event_widget_limit', 10, 2);
/**
* Test if the current widget is an Advanced List Widget and fix the event limit if it is.
*/
function increase_event_widget_limit(array $instance, $widget) {
if (is_a($widget, 'Tribe__Events__Pro__Advanced_List_Widget'))
$instance['limit'] = 30;
return $instance;
@theeventscalendar
theeventscalendar / move-edd-tickets-form.txt
Created September 8, 2015 17:21 — forked from geoffgraham/gist:0c2f380a8efccdb57e09
Move EDD Tickets Form above Event content
remove_action( 'tribe_events_single_event_after_the_meta', array( TribeEDDTickets::get_instance(), 'front_end_tickets_form'), 5 );
add_action( 'tribe_events_single_event_before_the_content', array( TribeEDDTickets::get_instance(), 'front_end_tickets_form') );
@theeventscalendar
theeventscalendar / change_events_view_titles.php
Created August 25, 2015 00:13 — forked from elimn/tribe_alter_event_archive_titles.php
Changes the title/headings on Events views
<?php
/*
* Alters event's archive titles
*/
function tribe_alter_event_archive_titles ( $original_recipe_title, $depth ) {
// Modify the titles here
// Some of these include %1$s and %2$s, these will be replaced with relevant dates
$title_upcoming = 'Upcoming Events'; // List View: Upcoming events