Skip to content

Instantly share code, notes, and snippets.

@jazbek
jazbek / gist:7442734
Last active January 4, 2019 05:10
Fix for broken tag archives
<?php
add_action( 'parse_query', 'tribe_fix_tag_query' );
function tribe_fix_tag_query( $query ) {
if ( $query->is_tag && (array) $query->get( 'post_type' ) != array( TribeEvents::POSTTYPE ) ) {
if ( empty( $query->query_vars['post_type'] ) ) {
$query->query_vars['post_type'] = array( 'post' );
}
if ( ! ( $query->query_vars['post_type'] == array( 'post' ) || $query->query_vars == 'post' ) ) {
remove_action( 'parse_query', array( 'TribeEventsQuery', 'parse_query' ), 50 );
@jazbek
jazbek / gist:7440874
Created November 12, 2013 23:45
Dequeue google maps
add_action('wp_enqueue_scripts', 'tribe_dequeue_google_maps', 11);
function tribe_dequeue_google_maps() {
wp_dequeue_script('gmaps');
}
@jazbek
jazbek / gist:7240619
Created October 30, 2013 21:29
Fix datepicker for satellite7 theme
<?php
add_action('admin_print_scripts', 'fix_satellite7_datepicker', 21);
function fix_satellite7_datepicker() {
global $typenow;
if ( class_exists('TribeEvents') && $typenow == TribeEvents::POSTTYPE ) {
?>
<script type="text/javascript">
jQuery(document).ready(function($){
$('.datepicker').datepicker('destroy');
@jazbek
jazbek / gist:7129020
Created October 24, 2013 00:07
Order events by their post date
<?php
add_action( 'pre_get_posts', 'tribe_post_date_ordering', 51 );
function tribe_post_date_ordering( $query ) {
if ( $query->tribe_is_multi_posttype) {
remove_filter( 'posts_fields', array( 'TribeEventsQuery', 'multi_type_posts_fields' ) );
$query->set( 'order', 'DESC' );
}
}
@jazbek
jazbek / gist:6820959
Created October 4, 2013 04:32
Fix comments form not working when using default events template
<?php
add_action( 'template_redirect', 'tribe_fix_comments' );
function tribe_fix_comments() {
if ( tribe_get_option( 'tribeEventsTemplate', 'default' ) == '' ) {
return apply_filters( 'comments_template', STYLESHEETPATH . '/comments.php' );
}
}
@jazbek
jazbek / gist:6797419
Last active December 24, 2015 12:19
Fix show events in main blog loop option with static front page
<?php
add_action( 'init', 'tribe_fix_homepage', 11, 1 );
function tribe_fix_homepage() {
remove_action( 'parse_request', array( 'TribeEventsQuery', 'parse_request' ), 50 );
add_action( 'parse_query', 'tribe_fix_homepage_query', 51 );
}
function tribe_fix_homepage_query( $query ) {
if ( ! $query->is_main_query() ) {
$query->is_home = false;
@jazbek
jazbek / gist:6597658
Last active December 23, 2015 06:59
Fix for events taking over the page title on non-event pages
<?php
add_action( 'pre_get_posts', 'tribe_fix_title' );
function tribe_fix_title( $query ) {
if ( $query->is_main_query() ) {
if ( ! $query->tribe_is_event_query ) {
$tec = TribeEvents::instance();
remove_filter( 'wp_title', array( $tec, 'maybeAddEventTitle' ), 10, 2 );
}
}
@jazbek
jazbek / gist:6585714
Created September 16, 2013 19:55
Fix for hosts with low join limit
<?php
add_action('init', 'tribe_allow_large_joins');
function tribe_allow_large_joins(){
global $wpdb;
$wpdb->query('SET SQL_BIG_SELECTS=1');
}
@jazbek
jazbek / gist:6355989
Created August 27, 2013 16:42
Add the recurrence schedule to the single event details
<?php
//
add_action('tribe_events_before_view','tribe_recurrence_schedule_meta');
function tribe_recurrence_schedule_meta(){
global $post;
// force this to run only on single event views
if( is_single() && tribe_is_event( $post->ID ) ){
if( tribe_is_recurring_event( tribe_is_recurring_event( $post->ID ) ) ) {
tribe_register_meta( 'tribe_recurrence_schedule', array(
@jazbek
jazbek / gist:6224473
Created August 13, 2013 18:58
Disable event organizer links
<?php
add_action('post_type_link', 'tribe_disable_organizer_links', 10, 2);
function tribe_disable_organizer_links($permalink, $post) {
if ($post->post_type == 'tribe_organizer') {
return false;
}
return $permalink;
}