Skip to content

Instantly share code, notes, and snippets.

@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
}
<!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: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;
}
@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: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 / 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 / gist:1252967
Created September 30, 2011 07:25
gala stripe test
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title> Checkout | Gala Demo 2011</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="robots" content="" />
<link rel="stylesheet" href="http://76.179.10.111/2011/wp-content/ms-themes/3/demo-gala-1/style.css">
@jazbek
jazbek / gist:3794979
Created September 27, 2012 16:33
Function to strip articles from slug. Slug can then be used to alphabetize post listings.
/**
* strip_articles_from_slug
*
* Remove a, an, the from post slugs on new posts, so post listings
* can be alphabetized by slug and ignore leading articles
*
* @param $postarr post being set up
* @param $data data for the database
* @return array
* @author Jessica Yazbek
@jazbek
jazbek / gist:3794993
Created September 27, 2012 16:34
Slide Carousel class
<?php
class Slide_Carousel {
/**
* class base for this component
*
* @var string
**/
static $id = 'slide-carousel';
@jazbek
jazbek / gist:4497389
Last active December 10, 2015 21:48
Insert the postmeta values needed for an ACF repeater field
add_filter('add_post_metadata', 'create_acf_repeater', 10);
function create_acf_repeater($check, $object_id, $meta_key, $meta_value)
{
if (strpos($meta_key, 'acf_repeater_') === 0)
{
$key_base = str_replace('acf_repeater_', '', $meta_key);
$meta_values = explode("\n", $meta_value);
add_post_meta($object_id, substr($key_base, 0, strpos($key_base, '_x_')), count($meta_values));
foreach ($meta_values as $i => $value)
{