Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@elimn
elimn / functions.php
Last active August 29, 2015 14:05 — forked from barryhughes/fast-forward-mini-cal.php
MT | TEC | Minicalendar widget > Show the month of the next upcoming event when current month is empty
<?php
/**
* Tries to force the minicalendar widget to show the month of the next upcoming event by default, rather
* than simply showing the current month (which might be empty).
*/
class Tribe_Advance_Minical
{
protected $target_date = false;
@elimn
elimn / functions.php
Last active August 29, 2015 14:08 — forked from kelly-tribe/alter-or-remove-heading.php
MT | TEC | Change Upcoming Events Title
<?php
add_filter('tribe_get_events_title', 'change_upcoming_events_title');
function change_upcoming_events_title($title) {
//We'll change the title on upcoming and map views
if (tribe_is_upcoming() or tribe_is_map() or tribe_is_photo()) return 'Upcoming Parties';
//In all other circumstances, leave the original title in place
return $title;
@elimn
elimn / functions.php
Last active August 29, 2015 14:09
MT | TEC | Set Events Category Default View
<?php
// Overrides every request for viewOption from TribeEvents::getOption()
function tribe_swap_default_category_view ($option, $default, $optionName) {
// For a list of acceptable views/values run print_r(tribe_events_enabled_views());
$default_events_view = 'month'; // The default view for the main page, venue, etc.
$default_category_view = 'list'; // The default view for any calendar category
@elimn
elimn / functions.php
Last active August 29, 2015 14:09
MT | TEC | Change all events to display as all day events
<?php
// Changes all events to display as all day events
function tribe_all_events_all_day ($output) {
if ( !is_admin() && tribe_is_event() ) {
$output = true;
}
return $output;
@elimn
elimn / functions.php
Last active August 29, 2015 14:09
MT | TEC | Selectively hide events from specific user roles
<?php
// Selectively hide events from specific user roles
function tribe_event_category_permissions ($wp_query) {
// Include all posts on admin views
if ( is_admin() ) return $wp_query;
$exclude_cats = array();
@elimn
elimn / functions.php
Last active August 29, 2015 14:09
MT | TEC | Allow "SQL_BIG_SELECTS", improving database performance on some MySQL configurations
<?php
// Allows "SQL_BIG_SELECTS", improving database performance on some MySQL configurations
function tribe_allow_large_joins(){
global $wpdb;
$wpdb->query('SET SQL_BIG_SELECTS=1');
}
add_action('init', 'tribe_allow_large_joins');
@elimn
elimn / functions.php
Last active August 29, 2015 14:09
MT | TEC | Adds the "WP Admin > Events: Upcoming" page, which only shows upcoming events
<?php
// Adds upcoming menu item to WP Admin Menu
function tribe_custom_admin_menu () {
add_submenu_page(
'/edit.php?post_type='.TribeEvents::POSTTYPE,
'Events: Upcoming',
'Events: Upcoming',
apply_filters( 'tribe_settings_req_cap', 'manage_options' ),
'edit.php?post_type='.TribeEvents::POSTTYPE.'&orderby=start-date&order=asc&upcoming-events=true'
@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_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';