Skip to content

Instantly share code, notes, and snippets.

View caseydriscoll's full-sized avatar

Casey Driscoll caseydriscoll

View GitHub Profile
function change_tribe_searchbar_search_placeholder_text( $filters ) {
$filters['tribe-bar-search']['html'] = '<input type="text" name="tribe-bar-search" id="tribe-bar-search" value="" placeholder="'. __('Find Events', 'tribe-events-calendar') .'">';
return $filters;
}
add_filter( 'tribe-events-bar-filters', 'change_tribe_searchbar_search_placeholder_text' );
@caseydriscoll
caseydriscoll / gist:20e7f714b90cd8c56d56
Created June 27, 2014 17:54
Tribe Unlimited iCal Feed
class UnlimitedICalFeed {
public static function setup() {
add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ), 75 );
}
public static function pre_get_posts( WP_Query $query ) {
if ( ! $query->tribe_is_event_query ) return self::shutdown();
if ( ! isset($_GET['ical'] ) || 'all' !== $_GET['ical'] ) return self::shutdown();
$query->set( 'posts_per_page', -1 );
}
@caseydriscoll
caseydriscoll / gist:45acdda5a7b3de558941
Created July 15, 2014 16:42
Tribe Events One Week Back
// Written by Barry Hughes of Modern Tribe
add_action( 'pre_get_posts', 'include_events_one_week_prior', 200 );
function include_events_one_week_prior( $query ) {
// Avoid fatals if TEC is deactivated
if ( ! class_exists( 'TribeEvents' ) ) return;
// Is it an events query?
if ( $query->get( 'post_type' ) !== TribeEvents::POSTTYPE ) return;
@caseydriscoll
caseydriscoll / single-event.php
Created July 16, 2014 16:04
Tribe Organizer in Month Tooltip
<?php
/**
* Month Single Event
* This file contains one event in the month view
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/month/single-event.php
*
* @package TribeEventsCalendar
* @since 3.0
* @author Modern Tribe Inc.
@caseydriscoll
caseydriscoll / functions.php
Created July 28, 2014 20:42
Tribe: Add class to list month header
// add anywhere in functions.php theme file
add_filter( 'tribe_events_list_the_date_headers', 'add_class_to_month_header' );
function add_class_to_month_header( $content ) {
$my_class = 'this-is-my-class';
$content = str_replace( 'tribe-events-list-separator-month', 'tribe-events-list-separator-month ' . $my_class, $content );
return $content;
}
@caseydriscoll
caseydriscoll / functions.php
Created August 6, 2014 15:21
Tribe: Change Community Events Error Message
// Add to your active theme's functions.php
add_filter( 'tribe_community_events_form_errors', 'ce_custom_error_msg' );
function ce_custom_error_msg( $errors ) {
// Don't filter if it is an 'update' or other type of message
if ( $errors[0]['type'] != 'error' ) return $errors;
$existing_errors = '';
$type = 'error';
@caseydriscoll
caseydriscoll / functions.php
Created August 6, 2014 15:42
Tribe: Change Community Events Success Message
// Add to functions.php
add_filter( 'tribe_community_events_form_errors', 'ce_custom_success_message' );
function ce_custom_success_message( $messages ) {
if ( $messages[0]['type'] != 'update' ) return $messages;
$existing_messages = '';
$type = 'update';
if ( is_array( $messages ) ) {
$existing_messages = $messages[0]['message'];
@caseydriscoll
caseydriscoll / functions.php
Created August 6, 2014 18:22
Tribe: Auto-publish a Community Event only if user is logged in
//Add to functions.php of your active theme
add_filter( 'tribe_events_community_sanitize_submission', 'set_community_events_publication_status' );
function set_community_events_publication_status( $submission ) {
// Escape, assuming default is set to 'draft' and 'allow anonymous submits'
if ( ! is_user_logged_in() ) return $submission;
$submission['post_status'] = 'publish';
return $submission;
}
@caseydriscoll
caseydriscoll / functions.php
Created August 6, 2014 21:06
Tribe: Change publish status of all submitted Community Events
//Add to functions.php of your active theme
add_filter( 'tribe_events_community_sanitize_submission', 'set_community_events_publication_status' );
function set_community_events_publication_status( $submission ) {
// Uncomment one of the lines below to change the default status
//$submission['post_status'] = 'publish';
//$submission['post_status'] = 'pending';
return $submission;
}
@caseydriscoll
caseydriscoll / functions.php
Created August 8, 2014 15:26
Tribe: On Community Events Submission, redirect on update, change message on error
function ce_custom_error_msg( $errors ) {
// Don't filter if it is an 'update' or other type of message
if ( $errors[0]['type'] != 'error' ) return $errors;
$existing_errors = '';
$type = 'error';
if ( is_array( $errors ) ) {
$existing_errors = $errors[0]['message'];
$type = $errors[0]['type'];