Skip to content

Instantly share code, notes, and snippets.

<?php
/* Tribe, limit ticket qty */
function tribe_limit_tickets() {
?>
<script type="text/javascript">
jQuery(document).ready( function( $ ) {
// do this if tickets available
if ( $('.tribe-events-tickets').length ) {
// set max qty to 1
@GeoffEW
GeoffEW / prevent_export.php
Last active October 2, 2022 15:15
Prevent calendar export links from showing anywhere on the front-end.
<?php
/**
* Prevent calendar export links from showing anywhere on the front-end.
*
*
*/
class Tribe__Events__Remove__Export__Links {
public function __construct() {
add_action( 'init', array( $this, 'single_event_links' ) );
@GeoffEW
GeoffEW / rsvp_control_strings.php
Last active August 30, 2022 07:17
RSVP control of strings
<?php
function tribe_custom_theme_text ( $translation, $text, $domain ) {
$custom_text = array(
'Confirm RSVP' => 'Confirm Reservation',
'RSVP' => 'Reservation',
'Please fill in the RSVP confirmation name and email fields.' => 'Please fill in the Reservation confirmation name and email fields.',
'Send RSVP confirmation to:' => 'Send Reservation confirmation to:'
);
@GeoffEW
GeoffEW / Restore_ticket_csv_export.php
Last active May 4, 2022 10:11
Restores meta field and ticket # in CSV export for ET+ and ET
<?php
function restore_ticket_csv_headers( $columns ) {
// Only meddle with the attendee csv export request
if ( ! isset( $_GET['attendees_csv'] ) ) return $columns;
// Tribe__Tickets__Tickets_Handler::instance() already owns an attendee
// table object but it is private and there is not currently an accessor
$attendees_table = new Tribe__Tickets__Attendees_Table();
@GeoffEW
GeoffEW / remove_recurrence_option.php
Created May 12, 2017 23:45
Tribe, remove recurrence from new event and edit event screens
<?php
/* Tribe, remove recurrence from new event and edit event screens */
function tribe_remove_recurrence ( ) {
remove_action( 'tribe_events_date_display', array( 'Tribe__Events__Pro__Recurrence__Meta', 'loadRecurrenceData' ) );
}
add_action( 'admin_init', 'tribe_remove_recurrence' );
@GeoffEW
GeoffEW / change_ticket_in_email.php
Last active October 19, 2020 19:07
change_ticket_in_email.php
<?php
function tribe_custom_theme_text ( $translation, $text, $domain ) {
// Put your custom text here in a key => value pair
// Example: 'Text you want to change' => 'This is what it will be changed to'
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label "Venue" to "Location", and "Related Events" to "Similar Events"
$custom_text = array(
@GeoffEW
GeoffEW / attendees-list.php
Last active February 24, 2020 09:46
* Renders the attendee list for an event and all the attendee information
<?php
/**
* Renders the attendee list for an event
*
* Override this template in your own theme by creating a file at:
*
* [your-theme]/tribe-events/attendees-list.php
*
* @version 4.3.5b
*
@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 / remove_free.php
Created November 1, 2016 04:50
The Events Calendar - Make code empty if it's 0 or Free
<?php
/*
* The Events Calendar - Make code empty if it's 0 or Free
*/
add_filter ( 'tribe_get_cost', 'tribe_not_show_free', 10, 3 );
function tribe_not_show_free ( $cost, $post_id, $with_currency_symbol ) {
if ( $cost == 0 || $cost == 'Free' ) {
$cost = '';
@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 );