Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
andrasguseo / tickets.php
Created February 8, 2024 10:57
ET > Template override for the tickets block - Hide tickets block when logged in user already has a ticket.
<?php
/**
* Block: Tickets
*
* This template override will hide the tickets block, if the logged in user
* has already purchased a ticket for the given event.
* For it to work the following setting has to be enabled:
* Tickets > Settings > General > Require users to log in before they purchase tickets
*
* This is a template ovverride for the following file:
@andrasguseo
andrasguseo / limit-ticket-quantity.php
Last active March 12, 2024 10:29
ET > Limit ticket quantity counter to 1
<?php
/**
* Limit ticket quantity counter to 1.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @author: Andras Guseo
*
* Plugins required: Event Tickets
* Created: February 7, 2024
@andrasguseo
andrasguseo / ticket-step-modifier.php
Last active February 7, 2024 18:27
ET > Make a ticket quantity selector step by 2
<?php
/**
* Make a ticket quantity selector step by 2.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @author: Andras Guseo
*
* Plugins required: Event Tickets
* Created: February 7, 2024
@andrasguseo
andrasguseo / event-title-target.php
Created February 6, 2024 14:52
TEC > Set a target for the event title
<?php
/**
* Set a target for the event title.
* The code adds a custom field for events where you can select the link target.
* A template override for each calendar view is needed where you want this implemented.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets
*
* @author: Andras Guseo
*
@andrasguseo
andrasguseo / show-for-first-attendee-only.php
Last active January 30, 2024 21:06
ET+ > Show Attendee Registration Field for first attendee only.
<?php
/**
* Show Attendee Registration Field for first attendee only.
* (Hide field for subsequent attendees.)
* Can handle multiple fields.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @author: Andras Guseo
*
@andrasguseo
andrasguseo / show-lat-long.php
Created January 29, 2024 23:33
CE > Show input for lat/long coordinates on the venue editing page in Community Events
<?php
/**
* Show input fields for lat/long coordinates on the venue editing page in Community Events.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @author: Andras Guseo
*
* Plugins required: The Events Calendar, Events Calendar Pro, Community Events
* Created: January 29, 2024
@andrasguseo
andrasguseo / tec-open-filterbar.php
Last active January 23, 2024 14:59
Filter Bar > Open the Filter Bar on mobile on initial pageload
<?php
/**
* Open the Filter Bar on mobile on initial pageload.
*
* By default, Filter Bar is closed on mobile regardless of the setting.
* With this snippet Filter Bar will show on pageload when using the horizontal setup.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @author: Andras Guseo
@andrasguseo
andrasguseo / tec-ea-maybe-remove-eventurl.php
Created January 18, 2024 21:20
EA > Remove the Event URL when it's the same as the source URL
<?php
/**
* Remove the Event URL when it's the same as the source URL.
*
* When importing from OtherURL and the EventURL field is empty, it will be filled with the
* URL of the source site by default. This snippet makes sure it stays empty.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @param array $event Event data to save
@andrasguseo
andrasguseo / et-custom-email-heading.php
Last active January 15, 2024 12:39
ET > Customize the Ticket Email heading to account for singular and plural versions
<?php
/**
* Customize the Ticket Email heading to account for singular and plural versions.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @param array $event Which Event data was sent
*
* @param string $heading The email heading.
* @param string $id The email id.
@andrasguseo
andrasguseo / custom-event-statuses.php
Created January 12, 2024 22:55
TEC > Add custom event statuses.
<?php
class MyCustomEventStatuses {
/**
* Constructor.
*/
public function __construct() {
add_filter( 'tec_event_statuses', [ $this, 'my_custom_statuses' ], 20, 2 );
add_filter( 'tribe_events_single_event_title_html', [ $this, 'tec_custom_status_on_single_classic' ], 10, 2 );