Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@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
@afragen
afragen / dmd-legend-fix.php
Last active August 29, 2015 14:18
Fix for danishmaritimedays.com
<?php
use Fragen\Category_Colors;
add_action( 'plugins_loaded', 'teccc_load_options_class', 20 );
function teccc_load_options_class() {
if ( class_exists( '\\Fragen\\Category_Colors\\Main' ) ) {
new Category_Colors_Options();
}
}
@afragen
afragen / tribe-ical-alarm.php
Created May 5, 2012 03:17
Add alarm to The Events Calendar Pro WP Plugin
<?php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_add_alarm', 10, 2 );
function tribe_ical_add_alarm( $item, $eventPost ) {
$alarm = tribe_get_custom_field( 'Alarm', $eventPost->ID );
if ( !empty( $alarm ) && is_numeric( $alarm ) ) {
$item[] = 'BEGIN:VALARM';
$item[] = 'TRIGGER:-PT' . $alarm . "M";
$item[] = 'END:VALARM';
}
@afragen
afragen / tribe-events-calendar-pro-modevent.php
Created May 9, 2012 23:59
Modify the DESCRIPTION of generated ical feed
<?php
//Add to your theme's functions.php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_modify_event', 10, 2 );
function tribe_ical_modify_event( $item, $eventPost ) {
$searchValue = "DESCRIPTION";
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $item);
$key = array_values($fl_array);
$keynum = key($fl_array);
@afragen
afragen / deploy.sh
Created May 11, 2012 02:34
Git -> Subversion one-step deployment script
#! /bin/bash
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.
# main config
PLUGINSLUG="the-events-calendar-pro-alarm"
CURRENTDIR=`pwd`
MAINFILE="the-events-calendar-pro-alarm.php" # this should be the name of your main php file in the wordpress plugin
# git config
@afragen
afragen / tribe-google-calendar-event-strip-tags.php
Last active October 5, 2015 05:47
Truncate the details parameter of Google calendar link to 1000 characters.
<?php
//Add the following to your theme's functions.php
add_filter( 'tribe_google_calendar_parameters', 'tribe_google_calendar_link_modify', 10, 2 );
function tribe_google_calendar_link_modify( $params ) {
$mod = urldecode( $params['details'] );
$mod = strip_tags( $mod );
$mod = str_replace( ' ', '+', $mod );
unset($params['details']);
$params['details'] = $mod;
@afragen
afragen / webcal.html
Created May 24, 2012 22:16
iCal subscribe link for The Events Calendar PRO
<!--
I've added the following link in The Events Calendar Settings > Templates > Display after calendar field. You'll obviously need to change the href to your site.
-->
<a href="webcal://troop262ps.org/events/ical/" class="ical">iCal Subscribe</a>
@afragen
afragen / tribe-ical-fix-endDate.php
Created June 8, 2012 02:02
Fix the endDate in ECP iCal feed.
<?php
//Add to theme functions.php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_fix_endDate', 10, 2 );
function tribe_ical_fix_endDate( $item, $eventPost ) {
$searchValue = "DTEND;VALUE";
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $item);
$key = array_values($fl_array);
$keynum = key($fl_array);
@afragen
afragen / pf.conf
Created July 27, 2012 16:38
pf action.d filter for fail2ban
# Fail2Ban configuration file
#
# OpenBSD pf ban/unban
#
# Author: Nick Hilliard <nick@foobar.org>
# http://pastebin.com/wXESQ1b4
#
[Definition]