Skip to content

Instantly share code, notes, and snippets.

@jazbek
jazbek / recurring-all.php
Created August 20, 2015 21:30
Add recurring-all class to /all/ page
<?php
add_filter( 'body_class', 'tribe_recurring_all_body_class', 10, 1 );
function tribe_recurring_all_body_class( $classes ) {
if ( function_exists( 'tribe_is_showing_all' ) && tribe_is_showing_all() ) {
$classes[] = 'recurring-all';
}
return $classes;
@jazbek
jazbek / w3tc-mu.md
Last active February 8, 2018 05:29 — forked from wturnerharris/w3tc-mu.md

###W3TC MU-Plugins Install

  1. ####Add Nginx Rewrite Rule -> .htaccess:

    • rewrite ^/(?:[_0-9a-zA-Z-]+/)?wp-content/plugins/w3-total-cache/(.*) /wp-content/mu-plugins/plugins/w3-total-cache/$1 last;
  2. ####Add WP-Config Option -> wp-config.php:

    • define('W3TC_DIR', dirname(FILE).'/wp-content/mu-plugins/w3-total-cache');
  3. ####Add w3tc plugin -> mu-plugins/:

  • Upload entire plugin to mu-plugins/w3-total-cache/
@jazbek
jazbek / gist:cd30fea9c9c46aeb134e
Created August 22, 2014 15:17
Restore day-only format for 2nd date in a date range in the same month
<?php
add_filter( 'tribe_format_second_date_in_range', 'tribe_restore_no_month_format', 10, 2 );
function tribe_restore_no_month_format( $format, $event ) {
if ( tribe_event_is_all_day( $event ) && tribe_get_end_date( $event, false, 'm' ) === tribe_get_start_date( $event, false, 'm' ) && tribe_get_end_date( $event, false, 'Y' ) === date( 'Y' ) ) {
$format = 'j';
}
return $format;
}
@jazbek
jazbek / gist:ed37b78ec720bdea1e0f
Created May 22, 2014 03:11
Don't update the event description at eventbrite
<?php
add_filter('tribe_events_eb_request', 'tribe_dont_send_eb_description', 10, 3);
function tribe_dont_send_eb_description( $request, $action, $params ){
// check if we're sending an event update
if ( $action == 'event_update' ) {
// parse the event data into an array
$event_info = array();
parse_str( $params, $event_info );
@jazbek
jazbek / gist:11382578
Last active August 29, 2015 14:00
Filter a category out of the filter bar options
<?php
add_filter( 'tribe_events_filter_values', 'tribe_filter_event_categories', 10, 2 );
function tribe_filter_event_categories( $values, $slug ) {
if ( $slug == 'eventcategory' ) {
foreach ( $values as $i => $category ) {
if ( $category['name'] == 'Event Category 1' ) {
unset ( $values[$i] );
break;
}
<!doctype html>
<head>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #E22262; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
@jazbek
jazbek / gist:9285111
Created March 1, 2014 04:21
Customize the organizer info that's sent to Eventbrite - only works with Eventbrite Tickets v 3.5+
<?php
add_filter('tribe_events_eb_request', 'tribe_fix_eb_organizer_website', 10, 3);
function tribe_fix_eb_organizer_website( $request, $action, $params ){
if ( strpos( $action, 'organizer' ) !== false ) {
$params_array = array();
parse_str( $params, $params_array );
if ( $params_array['name'] == 'My Organizer' ) { // replace 'My Organizer' with the name of your organizer
$params_array['description'] = 'Put what you want in the organizer description here'; // customize this text
}
@jazbek
jazbek / gist:8428371
Created January 15, 2014 00:00
Fix broken sliders in some themes with The Events Calendar 3.2+
<?php
add_filter( 'tribe_events_query_posts_fields', 'tribe_fix_multi_posttype_fields', 10, 2 );
function tribe_fix_multi_posttype_fields( $fields, $query ) {
global $wpdb;
if ( $query->tribe_is_multi_posttype ) {
foreach ( $fields as $key => $field ) {
$fields[$key] = str_replace( $wpdb->postmeta, 'tribe_event_postmeta', $field );
@jazbek
jazbek / gist:8312881
Created January 8, 2014 07:00
Fix photo view losing the category when paginated
<?php
add_filter( 'tribe_events_pro_pre_get_posts', 'tribe_fix_photo_category_pagination' );
function tribe_fix_photo_category_pagination( $query ) {
// check & set event category
if ( isset( $_POST['tribe_event_category'] ) && $query->get( TribeEvents::TAXONOMY ) == '' ) {
$query->set( TribeEvents::TAXONOMY, $_POST['tribe_event_category'] );
}
return $query;
@jazbek
jazbek / gist:7491289
Created November 15, 2013 20:47
Fix google maps on https
<?php
add_filter( 'tribe_get_embedded_map', 'tribe_fix_google_maps_https' );
function tribe_fix_google_maps_https( $html ) {
if ( is_ssl() ) {
$html = str_replace( 'http://', 'https://', $html );
}
return $html;
}