Skip to content

Instantly share code, notes, and snippets.

View baerkins's full-sized avatar
🌵

Shaun Baer baerkins

🌵
  • Philadelphia, PA
View GitHub Profile
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@baerkins
baerkins / tribe_tooltip_month_readme.md
Created April 4, 2014 13:55
Modern Tribe Tooltip Readme, stripped form month/single-event.php

How to Use the Javascript Templating System in this View

Month view (and week in events pro) has implemented javascript templating to power its rich tooltips and mobile views as of Events Version 3.3. This is a guide on how to modify, extend and use this functionality.

  1. Overview

As of version 3.3 our tooltips and mobile views use a custom javascript templating solution.

// Add Favicon
function favicon() {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_template_directory_uri().'/assets/favicon/favicon.ico" />';
}
add_action('wp_head', 'favicon');
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@baerkins
baerkins / functions.php
Created December 2, 2014 21:23
Reverse order of Past Events in Tribe Events Calendar via https://gist.github.com/elimn/0be6c4cbcf80b3721c81
<?php
function tribe_past_reverse_chronological ($post_object) {
$past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'past') ? true : false;
if(tribe_is_past() || $past_ajax) {
$post_object = array_reverse($post_object);
}
return $post_object;
/*
* search an array recursively to find
* the first instance of a key and return its value
*
* useful when you do not know the location of a key nested (only once) in a multidimensional array
*
*/
function array_find_first_recursive($needle_key, array $haystack) {
if (array_key_exists($needle_key, $haystack)) {
@baerkins
baerkins / repeatable-fields-metabox.php
Created February 18, 2016 03:44 — forked from helen/repeatable-fields-metabox.php
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {
/**
* Allow past events to be queried in ACF Post Object
* Add 'custom' to query as per tribe_get_events();
*
* @link https://theeventscalendar.com/knowledgebase/using-tribe_get_events/
*/
function my_relationship_query( $args, $field, $post ) {
$args['eventDisplay'] = 'custom';
@baerkins
baerkins / sidebar_taxonomy_term_list.php
Created April 10, 2014 17:39
This gist creates a list of custom taxonomy terms in Wordpress. - It will display the child terms of a the current taxonomy term that is being viewed. - If the term being viewed is a child term, it will show the child terms of its parent. - The children of other terms will be hidden.
<?php
// List Custom Taxonomy Terms Based on Current View
// Setup global variables
$current_taxonomy = 'project_status';
$current_term_id = get_queried_object()->term_id;
$terms = get_terms($current_taxonomy);
// For a Single Post, get the ID of each term used
@baerkins
baerkins / calendar.md
Last active June 28, 2017 14:09
Tribe Event Calendar Content Options

Calendar Event Content Options

There are many variables at play when events are created. This is a list of content pieces that Tribe Events can output by default:

Basic Data

  • Title
  • Content
  • Featured Image
  • Event Category
  • Tags