Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / x-chars-extra.php
Created October 9, 2013 01:29
"The plugin generated x characters of unexpected output during activation" error during WP plugin activation. Add the code to your plugin to see where the error is.
<?php
add_action('activated_plugin','save_error');
function save_error(){
update_option('plugin_error', ob_get_contents());
}
echo get_option('plugin_error');
@afragen
afragen / gist:9865801
Created March 30, 2014 01:24
Display EDD Ticket downloads only on specific page(s). Modified from @sumobi
<?php
function sumobi_edd_downloads_query( $query, $atts ) {
global $wp_query;
if ( 'insert_page_slug_here' === $wp_query->query_vars['pagename'] ) {
$query['meta_key'] = '_tribe_eddticket_for_event';
}
return $query;
}
@afragen
afragen / admin-user-can.php
Created September 3, 2014 23:41
A plugin to show that an admin user really can do anything.
<?php
/*
Plugin Name: Admin User Can
Plugin URI: https://gist.github.com/afragen/97ac1e349316f51fd40c
Author: Andy Fragen
Author URI: http://thefragens.com/
Description: A plugin to show that an admin user really can do anything.
Version: 0.0.1
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html