Skip to content

Instantly share code, notes, and snippets.

@geoffgraham
geoffgraham / custom-notice.php
Created June 14, 2016 19:05
The Events Calendar 4.2 // Remove "This event has passed" notice on single-event.php in a specific category
// Removes the passed event notice for events in a speicifc category
add_filter( 'tribe_the_notices', 'customize_notice', 10, 2 );
function customize_notice( $html, $notices ) {
// If text is found in notice, then replace it
if (tribe_event_in_category('formation-sur-demande') && stristr( $html, 'This event has passed.' ) ) {
// Customize the message as needed
$html = str_replace( '', $html );
}
return $html;
@geoffgraham
geoffgraham / tribe-community-custom-header.php
Created May 18, 2016 14:28
Community Events 4.1.1 // Add content before Community Events "My Events" HTML
add_filter('tribe_events_before_html', 'tribe_custom_commmunity_content');
function tribe_custom_commmunity_content() {
// We'll add content to the Community Events header only
if ( tribe_is_community_my_events_page() )
return '<p>Your custom content here!</p>';
}
@geoffgraham
geoffgraham / tickets.php
Last active May 9, 2016 15:28
Event Tickets Plus 4.1.2 // Conditional logic to Woo ticket form to check for logged in users
<?php
/**
* Renders the WooCommerce tickets table/form
*
* @version 4.1
*
*/
/**
* @var bool $global_stock_enabled
@geoffgraham
geoffgraham / tribe-community-custom-header.php
Created April 21, 2016 20:29
Community Events 4.1.1 // Add content before Community Events HTML
add_filter('tribe_events_before_html', 'tribe_custom_commmunity_content');
function tribe_custom_commmunity_content() {
// We'll add content to the Community Events header only
if ( tribe_is_community_edit_event_page() )
return '<p>Your custom content here!</p>';
}
@geoffgraham
geoffgraham / gist:c1651175a852b00abed7b99b6b8c2df4
Created April 18, 2016 20:20
The Events Calendar 4.1.2 // Add content Month View HTML
// Add custom content before all the calendar views, ignore single event view
add_action( 'tribe_events_before_html', 'output_custom_code' );
function output_custom_code() {
// Check if displaying full month view
if( tribe_is_month() ) {
echo 'Your custom code to display.';
}
}
@geoffgraham
geoffgraham / list-widget.php
Created April 12, 2016 14:56
Events Calendar PRO 4.1.1 // Link List Widget "View More" to List View
<?php
/**
* Events Pro List Widget Template
* This is the template for the output of the events list widget.
* All the items are turned on and off through the widget admin.
* There is currently no default styling, which is highly needed.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/pro/widgets/list-widget.php
*
* When the template is loaded, the following vars are set:
@geoffgraham
geoffgraham / before-html.php
Last active March 21, 2016 16:15
The Events Calendar 4.1 // Show custom code on full calendar views
// Add custom content before all the calendar views, ignore single event view
add_action( 'tribe_events_before_html', 'output_custom_code' );
function output_custom_code() {
// Check if displaying a full calendar view
if( ! is_single() ) {
echo 'Your custom code to display.';
}
}
@geoffgraham
geoffgraham / example.php
Last active January 12, 2016 16:44
The Events Calendar 4.0.4 // Use full size thumbnail in Month View tooltip
if ( function_exists( 'tribe_is_event') ) {
/**
* Modifying the thumbnail arguments in Month view tooltip from a filter.
*
* @link https://theeventscalendar.com/support/forums/topic/month-view-tooltip-image-size/
* @return array
*/
function change_tribe_json_tooltip_thumbnail( $json ) {
$event_id = get_the_ID();
@geoffgraham
geoffgraham / gist:39d59bf67175e9b93bda
Created January 7, 2016 16:24
The Events Calendar 4.0.4 // Reverse Chronological Order for List View
// Changes listed event views to reverse chronological order
function tribe_past_reverse_chronological ($post_object) {
$past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'upcoming') ? true : false;
if(tribe_is_past() || tribe_is_upcoming() || $past_ajax) {
$post_object = array_reverse($post_object);
}
return $post_object;
}
add_filter('the_posts', 'tribe_past_reverse_chronological', 100);
@geoffgraham
geoffgraham / default-template.php
Created December 29, 2015 16:31
The Events Calendar 4.0.4 // Require login to view calendar
<?php
/**
* Default Events Template
* This file is the basic wrapper template for all the views if 'Default Events Template'
* is selected in Events -> Settings -> Template -> Events Template.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/default-template.php
*
* @package TribeEventsCalendar
*