Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
andrasguseo / functions.php
Last active November 7, 2024 22:00
TEC > Block REST API requests coming from EA.
<?php
/**
* Block REST API requests coming from Event Aggregator. Basically blocks imports.
* It can block other sites trying to siphon events with EA through the "Other URL" source.
*
* Usage: Add the snippet with a plugin like Code Snippets or to your functions.php file.
*
* @author: Andras Guseo
*
* Plugins required: The Events Calendar
@andrasguseo
andrasguseo / functions.php
Created November 7, 2024 13:16
TEC > Change event content im the subscription feed
<?php
/**
* Changes the event title and description in the iCal feed which is used to export events or
* subscribe to the calendar. Can be used to prank subscribers to the calendar. :)
*
* Usage: Add the snippet with a plugin like Code Snippets or to your functions.php file.
*
* @author: Andras Guseo
*
* Plugins required: The Events Calendar
@andrasguseo
andrasguseo / functions.php
Last active November 4, 2024 11:14
ECP > Add the virtual event URL to the end of the description in the iCal exports.
<?php
/**
* Insert virtual event meeting URL at the end of the description.
*
* @param array $item Array of items describing the event in ical format.
* @param object $event The event object.
*
* @return array
*/
add_filter( 'tribe_ical_feed_item', function ( $item, $event ) {
@andrasguseo
andrasguseo / functions.php
Created October 22, 2024 19:05
ET > Trash (or delete) orphaned tickets
<?php
/**
* Trash (or delete) orphaned Tickets Commerce tickets.
*
* Usage: Add the snippet with a plugin like Code Snippets.
* Save it as a "Run once" snippet.
* Go to the All Snippets page and run the snippet.
*
* @author: Andras Guseo
*
@andrasguseo
andrasguseo / functions-1.php
Last active October 8, 2024 22:12
TEC > Button to show future events only
<?php
/**
* This will add a button next to the bulk actions.
*/
add_action( 'restrict_manage_posts', 'filter_future_events' );
function filter_future_events() {
global $typenow;
// Check that we're on the correct post type
if ( $typenow == 'tribe_events' ) {
@andrasguseo
andrasguseo / attendee-fields.php
Created September 10, 2024 18:52
ETP > Template overrides for the PDF file generation
<?php
/**
* PDF Pass: Body - Ticket Info - Attendee Fields
*
* Place this template in your own theme by creating a file at:
* wp-content/themes/[your-theme]/tribe/tickets-plus/integrations/event-tickets-wallet-plus/pdf/pass/body/ticket-info/attendee-fields.php
*
* See more documentation about our views templating system.
*
* @link https://evnt.is/event-tickets-wallet-plus-tpl Help article for Wallet Plus template files.
@andrasguseo
andrasguseo / calendar-events.php
Created July 25, 2024 10:54
TEC > Template overrides for the month view to include all events in the "Month view events per day" setting.
<?php
/**
* View: Month View - Calendar Events
*
* This is an override for the following template:
* wp-content/plugins/the-events-calendar/src/views/v2/month/calendar-body/day/calendar-events.php
*
* Override this template in your own theme by creating a file at:
* wp-content/themes/[your-theme]/tribe/events/v2/month/calendar-body/day/calendar-events.php
*
@andrasguseo
andrasguseo / event-uid-to-ical-feed.php
Last active August 12, 2024 17:24
TEC > Generate a UID for the event and add it to the iCal feed.
<?php
/**
* Description: Generate a UID for the event and add it to the iCal feed.
* Usage: Paste the below snippet into your active (child) theme's functions.php file
* or use a plugin like Code Snippets.
*
* Plugins: The Events Calendar
* Author: Andras Guseo
* Last updated: 2024-07-22
*/
@andrasguseo
andrasguseo / functions.php
Created June 28, 2024 22:42
TEC > Show event search results in list view
<?php
add_filter( 'tribe_events_views_v2_rest_params', 'tec_redirect_search_to_list_view', 10, 2 );
function tec_redirect_search_to_list_view( $params, $request ) {
$ref = $_SERVER['HTTP_REFERER'];
// Are you coming from the list view?
$coming_from_list = str_contains( $ref, '/list/' );
if (
@andrasguseo
andrasguseo / functions.php
Last active June 28, 2024 21:35
TEC > Adding the event status column to the events admin and making it sortable
<?php
/**
* Description: Adds the event status column to the events admin and makes it sortable.
* Usage: Paste the below snippet into your active (child) theme's functions.php file
* or use a plugin like Code Snippets.
*
* Plugins: The Events Calendar
* Author: Andras Guseo, Masood Ahmed Khan, Guga Alvez
* Last updated: 2024-06-28
*/