Skip to content

Instantly share code, notes, and snippets.

@elimn
elimn / tribe_one_year_ics_export.php
Last active April 21, 2016 21:54
MT | TEC | Export 1 year of iCal events from The Events Calendar
<?php
/*
* The Events Calendar Get Events for 1 Year from Today in iCal Export File
* add coding to theme's functions.php
* To trigger the export go to this URL: http://yoursite.com/events/?ical=1&year-feed
* You can change 365 (days) to export more or less events
*/
function tribe_one_year_ics_export( $query ) {
if ( ! isset( $_GET['ical'] ) || ! isset( $_GET['year-feed'] ) ) {
@elimn
elimn / tribe_recurring_canonical_adjuster.php
Created March 17, 2016 07:18
MT | TEC | Swap the canonical URL for the /all/ page on recurring events
<?php
/*
* Swaps the canonical URL for the /all/ page on recurring events
*/
function tribe_recurring_canonical_adjuster() {
if ( ! tribe_is_recurring_event() ) return;
remove_action( 'wp_head', 'rel_canonical' );
add_action( 'wp_head', 'tribe_rel_canonical' );
@elimn
elimn / tribe_month_event_title_truncator.php
Last active March 4, 2016 13:28
MT | TEC | Truncate event titles in Month (Grid) view
<?php
/*
* Truncates event titles in Month (Grid) view
*/
function tribe_month_event_title_truncator( $title, $id = null ) {
$is_month_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX && tribe_is_month() );
$is_month_main = ( is_main_query() && tribe_is_month() );
@elimn
elimn / Tribe_Events_Change_Default_Times.php
Last active February 24, 2016 06:22
MT | TEC | Change the default start/end time for new events
<?php
/*
* Change the default start/end time for new events.
* EXAMPLE USAGE: new Tribe_Events_Change_Default_Times( '9:30am', '1pm' );
*/
class Tribe_Events_Change_Default_Times
{
protected $start_time = null;
@elimn
elimn / tribe_ce_redirect_login.php
Created February 10, 2016 20:57
MT | TEC | Community Events redirect to custom login form
<?php
/*
* The Events Calendar Community Events redirect to custom login form
*/
function tribe_ce_redirect_login () {
wp_safe_redirect( site_url( '/login/' ) );
exit;
}
add_action ( 'tribe_ce_event_submission_login_form', 'tribe_ce_redirect_login' );
@elimn
elimn / tribe_events_get_ticket_event.php
Created February 4, 2016 22:59
MT | ETP | Add event start date to ticket titles in email order and checkout screens
<?php
/*
* Adds Event start date to ticket order titles in email order and checkout screens
* NOTE: For recurring events the start date is always the first event in the series
* not the start_date of the recurrence the user was viewing when placing their order
*
* @param string $title Title of the product, for tickets this is the ticket name
* @param array $item The product details as generated by Woo
*/
@elimn
elimn / tribe_bar_remove_placeholder.php
Created January 28, 2016 07:04
MT | TEC | Remove placeholder HTML attribute from Tribe Bar elements
<?php
/*
* Remove placeholder HTML attribute from Tribe Bar elements
*/
function tribe_bar_remove_placeholder( $filters ) {
foreach ( $filters as $fkey => $fval ) {
$filters[$fkey]['html'] = preg_replace('/placeholder="[^"]*"/', '', $filters[$fkey]['html']);
}
@elimn
elimn / FrontendAttendeeData.php
Created January 5, 2016 19:06
MT | ETP | List attendees on the single events page
<?php
/**
* List attendees on the single events page (WooCommerce-based orders
* in this example).
*
* This is just a quick hack/possible starting point - be nice to add a
* helper/template tag within Event Tickets to get the attendee list or
* change the public visibility of Tribe__Tickets__Tickets::get_attendees()
* to make it easier for folks to roll their own.
@elimn
elimn / tribe_et_move_tickets_purchase_form.php
Last active August 11, 2016 23:54
MT | ET | Move the front-end ticket purchase form
<?php
/*
* Moves the front-end ticket purchase/RSVP form, accepts WP action/hook and optional hook priority
*
* @param $ticket_location_action WP Action/hook to display the ticket form at
* @param $ticket_location_priority Priority for the WP Action
*/
function tribe_et_move_tickets_purchase_form ( $ticket_location_action, $ticket_location_priority = 10 ) {
if ( ! class_exists( 'Tribe__Tickets__Tickets') ) return;
@elimn
elimn / tribe_prevent_ajax_paging.php
Last active June 12, 2018 17:41
MT | TEC | Prevent Next/Prev pages from being loaded via Ajax in List and Month views
<?php
/*
* Prevents Next/Prev pages from being loaded via Ajax in List and Month views
*/
function tribe_prevent_ajax_paging() {
echo "
<script>
jQuery(document).ready(function(){