Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
GeoffEW / hide_hours.css
Created July 22, 2017 04:46
Uses CSS to hide certain hours in the week view
/* start at 8:00 AM */
.tribe-week-grid-inner-wrap > .tribe-week-grid-block:nth-child(-n+8),
.tribe-week-grid-hours > div:nth-child(-n+8) {
display: none;
}
/* end at 10:00 PM */
.tribe-week-grid-inner-wrap > .tribe-week-grid-block:nth-child(11),
.tribe-week-grid-hours > div:nth-child(11) {
display: none;
@GeoffEW
GeoffEW / unhook_recurring_events_community.php
Created May 22, 2017 18:50
Removes the recurring events option from Community Events
<?php
/* Apply the following snippet in the functions.php file of your theme (without the PHP tag at the top) */
add_action( 'tribe_events_community_form', function() {
$event_form = Tribe__Events__Community__Main::instance()->form;
remove_action( 'tribe_events_date_display', array( $event_form, 'loadRecurrenceData' ) );
}, 5 );
@GeoffEW
GeoffEW / remove_child_photo.php
Created May 18, 2017 05:51
Tribe, remove child recurring events from photo view
<?php
/* Tribe, remove child recurring events from photo view */
function tribe_set_default_date ( $query ) {
if ( tribe_is_photo() ) {
$query->set( 'post_parent', '0' );
}
}
add_action( 'pre_get_posts', 'tribe_set_default_date', 15 );
@GeoffEW
GeoffEW / remove_recurrence_option.php
Created May 12, 2017 23:45
Tribe, remove recurrence from new event and edit event screens
<?php
/* Tribe, remove recurrence from new event and edit event screens */
function tribe_remove_recurrence ( ) {
remove_action( 'tribe_events_date_display', array( 'Tribe__Events__Pro__Recurrence__Meta', 'loadRecurrenceData' ) );
}
add_action( 'admin_init', 'tribe_remove_recurrence' );
@GeoffEW
GeoffEW / post_category_support.php
Created May 10, 2017 04:26
add support for post categories to tribe events
<?php
/* Tribe, add support for post categories */
function change_event_type_args ( $args ) {
$args['taxonomies'][] = 'category';
return $args;
}
add_filter('tribe_events_register_event_type_args', 'change_event_type_args');
@GeoffEW
GeoffEW / show_all_markers_on_map_view.php
Created May 9, 2017 06:36
Show all markers on Map view
<?php
function show_all_markers( $data ) {
if ( ! isset( $data['markers'] ) ) return $data;
$cached_markers = get_transient( 'all_geo_markers_store' );
if ( $cached_markers ) {
$data['markers'] = $cached_markers;
return $data;
}
@GeoffEW
GeoffEW / modify_week_widget_date_format.php
Created May 5, 2017 01:42
Remove st, nd, rd from the date format in the week widget
<?php
/* Tribe, modify this week widget date format */
function tribe_modify_this_week_date_format ( ) {
return 'j';
}
add_filter( 'tribe_events_this_week_date_format', 'tribe_modify_this_week_date_format' );
@GeoffEW
GeoffEW / attendees-list.php
Last active February 24, 2020 09:46
* Renders the attendee list for an event and all the attendee information
<?php
/**
* Renders the attendee list for an event
*
* Override this template in your own theme by creating a file at:
*
* [your-theme]/tribe-events/attendees-list.php
*
* @version 4.3.5b
*
@GeoffEW
GeoffEW / prevent_title_change.php
Created April 24, 2017 17:21
Prevents the <title> attribute for the page (displayed in the browser tab) from changing to “Events for <month> <year> – <sitename>” when navigating in a calendar embedded in a page using a full calendar shortcode.
<?php
(function () {
var lastTitle = undefined;
function checkTitle() {
if (lastTitle != document.title) {
document.title = 'My Desired Title';
lastTitle = document.title;
}
setTimeout(checkTitle, 100);
};
@GeoffEW
GeoffEW / tribe-woo-catalog-hidden.php
Last active May 26, 2017 02:18
WooCommerce Tickets - Set Catalog visibility to Hidden for all Tickets Raw
<?php
/*
* The Events Calendar - WooCommerce Tickets - Set Catalog visibility to Hidden for all Tickets
* Alternative Hooks:
* wootickets_after_update_ticket
* wootickets_after_create_ticke
* @version 3.12
*/
add_action( 'wootickets_after_save_ticket', 'tribe_events_woo_change_visibility' );
function tribe_events_woo_change_visibility( $ticket_ID ) {