Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / default-template.php
Created August 18, 2013 01:35
Template override for TEC 3.x and Desk Mess Mirrored theme. Place in THEME/tribe-events/ folder.
<?php
/**
* Default Events Template
* This file is the basic wrapper template for all the views if 'Default Events Template'
* is selected in Events -> Settings -> Template -> Events Template.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/default-template.php
*
* @package TribeEventsCalendar
* @since 3.0
@afragen
afragen / list-widget.php
Last active December 20, 2015 18:59
The Events Calendar template override for colorizing Events List widget using The Events Calendar Category Colors plugin.
<?php
/**
* Events List Widget Template
* This is the template for the output of the events list widget.
* All the items are turned on and off through the widget admin.
* There is currently no default styling, which is needed.
*
* This view contains the filters required to create an effective events list widget view.
*
* You can recreate an ENTIRELY new events list widget view by doing a template override,
@afragen
afragen / list-widget.php
Last active December 20, 2015 17:49
Template overrides to colorize TECPro widgets using The Events Calendar Category Colors plugin. The templates belong in {THEME}/tribe-events/widgets/ or {THEME}/tribe-events/widgets/mini-calendar/
<?php
//this belongs in {THEME}/tribe-events/pro/widgets/
/**
* Events Pro List Widget Template
* This is the template for the output of the events list widget.
* All the items are turned on and off through the widget admin.
* There is currently no default styling, which is highly needed.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/widgets/list-widget.php
@afragen
afragen / show-category-description.php
Last active December 20, 2015 12:49
For The Events Calendar. This will show the event category description below the title. This example only shows in list view. Place in functions.php
<?php
add_action( 'tribe_events_after_the_title', 'my_category_description' );
function my_category_description() {
global $wp_query;
if( !isset( $wp_query->query_vars['post_type'] ) or !isset( $wp_query->query_vars['eventDisplay'] ) or !isset( $wp_query->queried_object ) ) return;
if( $wp_query->query_vars['post_type'] === 'tribe_events' or $wp_query->query_vars['post_type'][0] === 'tribe_events' and $wp_query->query_vars['eventDisplay'] === 'upcoming' )
echo '<div style="text-align:center;">' . $wp_query->queried_object->description . '</div>';
}
@afragen
afragen / tribe-events-ical-outlook-modify.php
Last active December 20, 2015 00:59
For use with The Events Calendar PRO. Just a quick function to remove the 'X-WR-CALNAME' header in the ical .ics file so it imports into Outlook. Place in theme's functions.php file, but it will affect every generated ics file.
<?php
add_filter( 'tribe_ical_properties', 'tribe_ical_outlook_modify', 10, 2 );
function tribe_ical_outlook_modify( $content ) {
$properties = preg_split ( '/$\R?^/m', $content );
$searchValue = "X-WR-CALNAME";
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $properties);
$key = array_values($fl_array);
$keynum = key($fl_array);
@afragen
afragen / email-users-custom-list.php
Created July 13, 2013 20:22
This is a simple plugin by Mike Walsh (mpwalsh8) to set custom meta filters for the Email Users plugin.
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/**
* @package Email-Users-Custom-List
* @version 1.3
*/
/*
Plugin Name: Email Users Custom List
Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/email-users-custom-list/
Description: This plugin shows how a custom meta filter can be used in conjunction with the Email Users plugin to address a Custom List of Users.
@afragen
afragen / load_myProcess.sh
Created June 17, 2013 18:29
Helper script with mount.sh. In this case makes sure iTunes is running after calling mount.sh. I use this script on my media server for LAN wide iTunes sharing.
#!/usr/bin/env bash
# script to start/keep iTunes running after mount.sh
# call from mount.sh
myProcess="/Applications/iTunes.app"
# sleep 5
ps ax | grep -v grep | grep -v iTunesHelper | grep $myProcess > /dev/null && exit 0
echo "opening $myProcess"
open -g $myProcess
@afragen
afragen / mount.sh
Created June 17, 2013 18:26
Call in launchd plist to run at user login to automatically mount a disk. Example usage iTunes Library stored on NAS.
#!/usr/bin/env bash
# call with `mount.sh true` for debug messages
version="1.0"
dbg=false
home_vols=( "/Volumes/iTunes" "/Volumes/Drobo" ) # order is important
webdav_vols=( "/Volumes/user1" "/Volumes/user2" "/Volumes/user3" )
home_router_mac="mac-address-here"
# how to grab drobo_ip based upon drobo mac address using `netstat -rnf inet`
drobo_mac="mac-address-here"
@afragen
afragen / current_ip.sh
Created June 17, 2013 18:17
I run this script using an ssh key to create a file with the current IP of my machine. Change user@host.com to a user with ssh key pair on your machine. I then access this file from my server.
#!/usr/bin/env bash
# This script should only generate an email when the WAN IP has changed.
# run in launchd
#test for any parameter, true if debugging
test -n "$1" && dbg=$1 || dbg=false #;dbg=true
echo "Running $0"
my_ip=`curl -s http://checkip.dyndns.org | awk '{print $6}' | awk ' BEGIN { FS = "<" } { print $1 } '`
@afragen
afragen / my-custom-titles.php
Created May 24, 2013 03:20
Change the title 'Calendar of Events' to your custom title.
<?php
add_filter('tribe_get_events_title','my_custom_titles');
function my_custom_titles($title) {
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
return 'JazzSchool Events';
} elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
return 'JazzSchool Events' . ' &raquo; ' . single_term_title('', false);
} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List