Skip to content

Instantly share code, notes, and snippets.

View baerkins's full-sized avatar
🌵

Shaun Baer baerkins

🌵
  • Philadelphia, PA
View GitHub Profile
/**
* 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 / 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() {
/*
* 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 / 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;
<?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
// 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');
@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.

<?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