Skip to content

Instantly share code, notes, and snippets.

@jentheo
jentheo / 119271-workaround.php
Created December 28, 2018 19:42
Temporary workaround for 119271
function tribe_mobile_default_view(){
?>
<script>
if(typeof tribe_ev !== "undefined"){
tribe_ev.fn.maybe_default_view_change = function(){
if (tribe_ev.data.redirected_view || !tribe_ev.data.default_view || !tribe_ev.data.default_mobile_view || tribe_ev.data.default_view == tribe_ev.data.default_mobile_view || !tribe_ev.state.view || tribe_ev.data.default_mobile_view == tribe_ev.state.view) {
return false;
}
var $body = jQuery( 'body' );
if ( ! $body.hasClass( 'tribe-mobile' ) ) {
@jentheo
jentheo / workaround.php
Created February 8, 2019 16:14
mobile view workaround
function tribe_mobile_default_view(){
?>
<script>
if(typeof tribe_ev !== "undefined"){
tribe_ev.fn.maybe_default_view_change = function(){
if (tribe_ev.data.redirected_view || !tribe_ev.data.default_view || !tribe_ev.data.default_mobile_view || tribe_ev.data.default_view == tribe_ev.data.default_mobile_view || !tribe_ev.state.view || tribe_ev.data.default_mobile_view == tribe_ev.state.view) {
return false;
}
var $body = jQuery( 'body' );
if ( ! $body.hasClass( 'tribe-mobile' ) ) {
@jentheo
jentheo / exclude-category.php
Created February 14, 2019 01:29
Exclude category(ies) from main event views
add_action( 'pre_get_posts', 'tribe_exclude_events_category' );
function tribe_exclude_events_category( $query ) {
if ( ! is_singular( 'tribe_events' ) ) {
if ( $query->query_vars['post_type'] == Tribe__Events__Main::POSTTYPE && ! is_tax( Tribe__Events__Main::TAXONOMY ) && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'tax_query', array(
array(
@jentheo
jentheo / copy-all-organizers.php
Created February 14, 2019 17:00
CC organizers on registrations
<?php
/**
* BCC event organizers email on all Event Tickets' RSVP and commerce ticket emails so they get a copy of it too
*/
function bcc_all_event_organizers( $headers, $event_id, $order_id ) {
//check if has organizer
if ( ! tribe_has_organizer( $event_id ) ) {
return $headers;
}
@jentheo
jentheo / single-event.php
Created February 21, 2019 00:04
Add city and state to event title in 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
* @version 4.6.21
*
@jentheo
jentheo / hide-recurrence.php
Last active February 22, 2019 04:10
Hide recurrence on home page
function tribe_hide_recurrence_on_homepage( $hide ) {
if ( is_front_page() ) {
$hide = true;
}
return $hide;
}
add_filter( 'tribe_events_pro_should_hide_recurrence', 'tribe_hide_recurrence_on_homepage' );
@jentheo
jentheo / mobile-styles.php
Last active February 23, 2019 17:52
Enqueue mobile styles
function theme_enqueue_styles() {
wp_register_style('tribemobile', '/wp-content/plugins/the-events-calendar/src/resources/css/tribe-events-full-mobile.min.css', array(), '1.0', '(max-width: 801px)');
wp_enqueue_style('tribemobile', false, array(), false, '(max-width: 801px)');
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
@jentheo
jentheo / open-graph-events-archive.php
Created February 26, 2019 16:27
Add open graph tags to event archive pages
/**
* The Events Calendar: Add Open Graph to <head> of Events Archive views.
*
* @link https://gist.github.com/cliffordp/5ed25b8bfb024efe73d1ce6c42d960aa
* @link http://ogp.me/
*/
function cliff_add_open_graph_tec_archive_views() {
// !!! CHANGE THIS URL !!!
$tec_archive_view_og_image_url = 'https://theeventscalendar.com/content/uploads/2013/07/screenshots4-2_single-event.png';
@jentheo
jentheo / index.php
Created February 27, 2019 11:24
Tweak to allow extension to work with tribe_events shortcode
<?php
/**
* Plugin Name: The Events Calendar PRO Extension: Display multiple events with the same venue in Map tooltips.
* Description: Show multiple events with the same venue in PRO's map tooltips.
* Version: 1.1
* Extension Class: Tribe__Extension__Multiple_Events_Same_Venue
* Author: Modern Tribe, Inc.
* Author URI: http://m.tri.be/1971
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html