This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Removes categories "meetup" and "shindig" from list and month views | |
*/ | |
function tribe_exclude_events_category( $wp_query ) { | |
// Slugs for the categories you wish to hide | |
$exclude_cats = array('meetup', 'shindig'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR | |
* See the codex to learn more about WP text domains: | |
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology | |
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'... | |
*/ | |
function tribe_custom_theme_text ( $translation, $text, $domain ) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$count = 0; | |
echo '<ul>'; | |
foreach ( $tickets as $ticket ) { | |
global $product; | |
$count++; | |
if ( class_exists( 'WC_Product_Simple' ) ) $product = new WC_Product_Simple( $ticket->ID ); | |
else $product = new WC_Product( $ticket->ID ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 »"; | |
} | |
return '<a href="' . tribe_get_event_website_url() . '" target="_blank">' . $label . '</a>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sets the default date for event queries. | |
* | |
* Expects to be called during tribe_events_pre_get_posts. Note that this | |
* function modifies $_REQUEST - this is needed for consistency because | |
* various parts of TEC inspect that array directly to determine the current | |
* date. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Redirect event category requests to list view. | |
* | |
* @param $query | |
*/ | |
function use_list_view_for_categories( $query ) { | |
// Disregard anything except a main archive query | |
if ( is_admin() || ! $query->is_main_query() || ! is_archive() ) return; | |
// We only want to catch *event* category requests being issued |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This changes the event link to the event website URL if that is set. | |
* NOTE: Comment out the add_filter() line to disable this function. | |
*/ | |
function tribe_set_link_website ( $link, $postId ) { | |
$website_url = tribe_get_event_website_url( $postId ); | |
// Only swaps link if set | |
if ( !empty( $website_url ) ) { |
NewerOlder