Skip to content

Instantly share code, notes, and snippets.

View bordoni's full-sized avatar
:shipit:
Working on The Events Calendar

Gustavo Bordoni bordoni

:shipit:
Working on The Events Calendar
View GitHub Profile
#tribe-events-content .tribe-events-calendar td {
color: #000;
background-color: #fff;
}
#tribe-events-content a {
color: #000;
}
<?php
/**
* Plugin Name: The Events Calendar: Snippet 945349
* Plugin URI: https://gist.github.com/bordoni/420661affe489e08fd5e
* Description: Wendy requested a snippet to use new data on Month and Week tooltips
* Version: 0.1.0
* Author: Gustavo Bordoni
* Author URI: http://bordoni.me
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
<?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
*
*/
<?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' ), 10, 2 );
$query->set( 'order', 'DESC' );
}
}
@bordoni
bordoni / gist:c9af7cdced204155a6e7
Created February 24, 2015 13:13
Ignore past Events on Previous button
<?php
add_filters( 'tribe_has_previous_event', 'tec_forum_944441', 11 )
function tec_forum_944441( $has_previous ){
global $wp_query;
$has_previous = false;
$past = tribe_is_past();
$upcoming = ! $past;
$cur_page = (int) $wp_query->get( 'paged' );
$max_pages = (int) $wp_query->max_num_pages;
@bordoni
bordoni / functions.php
Created February 23, 2015 22:34
How to add the event venue to the tooltip of the event
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
add_filter( 'tribe_events_template_data_array', 'tec_forum_939516', 11, 3 );
function tec_forum_939516( $json, $event, $additional ){
if ( tribe_has_venue( $event ) ){
$json['venue'] = 'Venue: <b>' . tribe_get_venue( $event ) . '</b>';
} else {
$json['venue'] = '';
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
// Usage tribe_is_past_event( $event_id )
function tribe_is_past_event( $event = null ){
if ( ! tribe_is_event( $event ) ){
return false;
}
$event = tribe_events_get_event( $event );
@bordoni
bordoni / singe-event.php
Created February 19, 2015 14:35
Showing Featured Images on the Month View
<?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
*
*/
<?php
// Register Redirect
add_filter( 'registration_redirect', '_forum_tec_registration_redirect' );
function _forum_tec_registration_redirect() {
return home_url( '/events/community/add' );
}
// Login Redirect
add_filter( 'login_redirect', '_forum_tec_login_redirect' );
function _forum_tec_login_redirect() {
@bordoni
bordoni / functions.php
Created February 5, 2015 04:37
How to add the Venue on The Events Calendar Month Tooltip
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
function tec_forum_939516( $json, $event, $additional ){
$venue = tribe_get_venue_id( $event );
if ( $venue ){
$json['venue'] = $venue;