Skip to content

Instantly share code, notes, and snippets.

@geoffgraham
geoffgraham / events-in-loop.php
Created December 5, 2016 23:55
The Events Calendar // Add Events to Main Blog Loop, with Custom Parameters
function my_custom_event_order( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'post_type','tribe_events');
$query->set( 'orderby','date');
$query->set( 'order','DESC');
return $query;
}
}
add_action( 'pre_get_posts', 'my_custom_event_order' );
@geoffgraham
geoffgraham / attendees-list.php
Created November 21, 2016 17:38
Event Ticket Plus 4.3.2 // attendees-list.php template override to show attendee name below avatar
<?php
/**
* Renders the attendee list for an event
*
* @version 4.1
*
*/
?>
<div class='tribe-attendees-list-container'>
<h2 class="tribe-attendees-list-title"><?php esc_html_e( 'Who\'s Attending', 'event-tickets-plus' ) ?></h2>
@geoffgraham
geoffgraham / reverse-alphabet-order.php
Last active December 19, 2016 21:11
The Events Calendar 4.2.6 // Display Upcoming Events in Descending Alphabetical Order
add_action( 'pre_get_posts', 'tribe_post_alphabetical_ordering', 51 );
function tribe_post_alphabetical_ordering( $query ) {
if( tribe_is_upcoming() ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
@geoffgraham
geoffgraham / grid.php
Last active August 9, 2016 15:06
Events Calendar PRO 4.2.3 // widgets/grid.php override
<?php
// Replaces Line 29
// Replace /events with the calendar slug, if different in the settings
?>
<span id="<?php echo esc_attr( $mini_cal_widget_id ) ?>"><a href="/events"><?php tribe_events_the_mini_calendar_title() ?></a></span>
@geoffgraham
geoffgraham / tribe-custom-export.php
Created July 26, 2016 15:42
The Events Calendar 4.2.3 // Export events from a specified post date
<?php
// When exporting Events, only grab the posts that match the post_modified date
function tribe_snippet_export_query( $query ) {
// You can adjust the strtotime() to point to the day you want to import from
$post_modified = date( 'Y-m-d H:i:s', strtotime( '-5 days' ) );
$query .= " AND post_modified >= '{$post_modified}' ";
remove_filter( 'query', 'tribe_snippet_export_query' );
@geoffgraham
geoffgraham / tribe-remove-photo-view-page-title
Created June 24, 2016 19:39
Events Calendar PRO 4.2.1 // Remove "Upcoming Events" Title in Photo View
add_filter('tribe_get_events_title', 'my_get_events_title');
function my_get_events_title($title) {
if( tribe_is_photo() && is_archive() ) {
return '';
} else {
return $title;
}
}
@geoffgraham
geoffgraham / tec-yoast-remove-page-title.php
Last active January 27, 2018 19:20
The Events Calendar - Yoast SEO - Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc.)
<?php
// Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,)
add_action( 'pre_get_posts', 'tribe_remove_wpseo_title_rewrite', 20 );
function tribe_remove_wpseo_title_rewrite() {
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) {
$wpseo_front = WPSEO_Frontend::get_instance();
remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 );
remove_filter( 'pre_get_document_title', array( $wpseo_front, 'title' ), 15 );
}
@geoffgraham
geoffgraham / tec-yoast-remove-page-title.php
Last active June 24, 2016 17:52
The Events Calendar - Yoast SEO - Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc.)
<?php
/*
Plugin Name: The Events Calendar Remove Events Archive from Yoast Page Title
Plugin URI: https://gist.github.com/geoffgraham/041c048aca979de714273314ae039ce7
Description: The Events Calendar - Yoast SEO - Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,)
*/
add_action( 'pre_get_posts', 'tribe_remove_wpseo_title_rewrite', 20 );
function tribe_remove_wpseo_title_rewrite() {
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) {
@geoffgraham
geoffgraham / tribe-tickets-no-ticket-text.php
Last active October 26, 2016 15:25
Event Ticket Plus 4.3.1 // Remove "Ticket will be sent in another email" text from WooCommerce email confirmation
/*
* The Events Calendar WooCommerce Tickets - Change You'll receive your tickets in another email.
* @ Version 4.3.1
*/
add_filter('wootickets_email_message', 'woo_tickets_filter_completed_order', 10 );
function woo_tickets_filter_completed_order($text) {
$text = "Your custom text";
return $text;
}
@geoffgraham
geoffgraham / single-event-php
Created June 15, 2016 16:39
The Events Calendar 4.2 // Single Event Template Override with Featured Image Above Title
<?php
/**
* Single Event Template
* A single event. This displays the event title, description, meta, and
* optionally, the Google map for the event.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php
*
* @package TribeEventsCalendar
*