Skip to content

Instantly share code, notes, and snippets.

@elimn
elimn / functions.php
Last active March 16, 2017 17:26
MT | TEC | Always show Next/Prev links in Month View
<?php
/**
* Allows visitors to page forward/backwards in any direction within month view
* an "infinite" number of times (ie, outwith the populated range of months).
*/
class ContinualMonthViewPagination {
public function __construct() {
add_filter( 'tribe_events_the_next_month_link', array( $this, 'next_month' ) );
add_filter( 'tribe_events_the_previous_month_link', array( $this, 'previous_month' ) );
@elimn
elimn / functions.php
Created December 2, 2014 22:27
MT | TEC | Tribe Query Debug
<?php
// Checks the URL for the debug parameter
// example.com/event/event-name/?tribe_query_debug=true
function tribe_events_pre_get_posts_dumper ($query) {
$show_debug_info = isset($_GET['tribe_query_debug']) ? $_GET['tribe_query_debug'] : false;
if(($show_debug_info == "true" && $query->is_main_query() === true) || $show_debug_info == "full") {
echo "<h3>&lt;Tribe Events Query&gt;</h3>";
tribe_spit_it_out($query);
@elimn
elimn / force_date_range_recalc.php
Last active August 29, 2015 14:10
MT | TEC | Fix Bug: Editted events do not change browsable date range of month view
<?php
// Fixes bug in TEC 3.8
// Edits of events will now update the month view browsable date range
function tribe_listen_for_event_updates() {
if ( class_exists( 'TribeEvents' ) )
add_action( 'save_post_' . TribeEvents::POSTTYPE, 'tribe_force_update_event_date_range' );
}
add_action( 'init', 'tribe_listen_for_event_updates' );
@elimn
elimn / tribe_set_embedded_map_height.php
Created December 6, 2014 02:50
MT | TEC | Set embedded map height
<?php
add_filter( 'tribe_get_option', 'tribe_adjust_embedded_map_height', 10, 2 );
function tribe_adjust_embedded_map_height( $value, $property ) {
if ( 'embedGoogleMapsHeight' !== $property ) return $value;
return '350px';
@elimn
elimn / tribe_attachment_404_fix.php
Last active January 23, 2018 21:00
MT | TEC | Fix for Single Event 404s with attachment set in WP Query
<?php
/*
* Possible solution for Single Event page 404 errors where the WP_Query has an attachment set
* IMPORTANT: Flush permalinks after pasting this code: http://tri.be/support/documentation/troubleshooting-404-errors/
*/
function tribe_attachment_404_fix () {
if (class_exists('TribeEvents')) {
remove_action( 'init', array( TribeEvents::instance(), 'init' ), 10 );
add_action( 'init', array( TribeEvents::instance(), 'init' ), 1 );
@elimn
elimn / tribe_set_geo_lookup_bounds.php
Created January 7, 2015 16:59
MT | TEC | Specify search area for Tribe Bar Location search
<?php
/*
* Set's Tec's preferred area for search results from the Location search in Tribe Bar
*/
function tribe_set_geo_lookup_bounds ($localizations) {
// SW corner of your bounds rectangle
$localizations['geocenter']['max_lat'] = '49';
$localizations['geocenter']['max_lng'] = '-8';
@elimn
elimn / tribe_strip_date_format_slashes.php
Last active February 23, 2020 22:42
MT | TEC | Escape characters in Events Calendar date format
<?php
/*
* This allows you to escape characters in TEC date formats
*
* Example date format: F \d\e j, Y
* Example date: dezembro de 31, 2014
* http://codex.wordpress.org/Formatting_Date_and_Time#Escaping
*
* You can change these formats in WP Admin > Events > Settings > Display
*/
@elimn
elimn / tribe_set_default_date.php
Last active April 19, 2022 13:26
MT | TEC | Set the default date for views like List and Month
<?php
/*
* Set the default date for views like List and Month
* Modify the $date variable below to set your date
*/
function tribe_set_default_date( $wp_query ) {
// Only run on main event queries
if ( ! tribe_is_event_query() || ! $wp_query->is_main_query() || $wp_query->get( 'eventDate' ) != '') return;
@elimn
elimn / tribe_set_link_website.php
Last active December 23, 2020 20:21
MT | TEC | Change event, venue, or organizer links to the relevant website URL
@elimn
elimn / tribe_remove_activation_page.php
Last active August 29, 2015 14:15
MT | TEC | Hide "Thanks for Updating" or installing page
<?php
/*
* Prevents Tribe Thanks for Updating page from automatically displaying
*/
function tribe_remove_activation_page() {
if ( class_exists( 'Tribe__Events__Activation_Page' ) ) {
remove_action( 'admin_init', array( Tribe__Events__Activation_Page::instance(), 'maybe_redirect' ), 10, 0 );
}