Skip to content

Instantly share code, notes, and snippets.

View tylerdigital's full-sized avatar

Nathan Tyler tylerdigital

View GitHub Profile
@tylerdigital
tylerdigital / gist:2027315
Created March 13, 2012 06:50
woothemes ping home issue
// In Canvas admin-interface.php
// executed on main theme options page
if ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] == 'woothemes' ) {
if ( get_option( 'framework_woo_theme_version_checker' ) == 'true' ) { add_action( 'admin_notices', 'woo_theme_update_notice', 10 ); }
// Which calls theme update notice (if it's not disabled)
if ( ! function_exists( 'woo_theme_update_notice' ) ) {
function woo_theme_update_notice () {
$theme_data = get_theme_data( get_template_directory() . '/style.css' );
@tylerdigital
tylerdigital / gist:2871384
Created June 4, 2012 23:05
Automatically activate Inform About Content plugin only on P2 blogs (WordPress multisite)
add_filter('option_active_plugins', 'p2_filter_active_plugins');
function p2_filter_active_plugins($active_plugins) {
if(get_template()!='p2') return $active_plugins;
$required_plugins = array(
'inform-about-content/inform-about-content.php'
);
foreach ($required_plugins as $key => $plugin) {
if(!(in_array($plugin, $active_plugins))) $active_plugins[] = $plugin;
@tylerdigital
tylerdigital / gf-select-custom-array-filter
Created August 23, 2012 20:31
Create a Gravity Form dropdown with custom array values
add_filter('gform_pre_render', 'tdgf_favorite_food');
function tdgf_favorite_food($form) {
if(empty($form['fields'])) return;
foreach ($form['fields'] as $key => &$field) {
if($field['cssClass']!='favorite_food' || empty($field['choices'])) continue;
$field['choices'] = array('apples' => 'Apples', 'oranges' => 'Oranges');
}
return $form;
<div id="testfield" class="span16">
<div class="flyout-wrap">
<a class="flyout-btn" href="#" title="Toggle"><span>Flyout Menu Toggle</span></a>
<ul class="flyout flyout-init">
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<div id="testfield" class="span16">
<div class="flyout-wrap">
<a class="flyout-btn" href="#" title="Toggle"><span>Flyout Menu Toggle</span></a>
<ul class="flyout flyout-init">
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<div id="testfield" class="span16">
<div class="flyout-wrap">
<a class="flyout-btn" href="#" title="Toggle"><span>Flyout Menu Toggle</span></a>
<ul class="flyout flyout-init">
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<div id="testfield" class="span16">
<div class="flyout-wrap">
<a class="flyout-btn" href="#" title="Toggle"><span>Flyout Menu Toggle</span></a>
<ul class="flyout flyout-init">
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<li><a href="#"><span>Item</span></a></li>
<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
/****
You should paste this into a file (in the example below : bp-customize-registration.php )
in your active theme's folder, then depending if your theme is a child theme or not you should
use this code in your functions.php to include the trick
<?php
// Fetch vars
$event = array(
'id' => $_GET['id'],
'title' => $_GET['title'],
'address' => $_GET['address'],
'description' => $_GET['description'],
'datestart' => $_GET['datestart'],
'dateend' => $_GET['dateend'],
'address' => $_GET['stage']
@tylerdigital
tylerdigital / td-post-by-email.php
Created June 18, 2013 20:54
A rough plugin for adding action tags to Jetpack's Post By Email. Note, these only get executed when clicking publish/update in the wp-admin currently. This is a project for personal use, any my needs were to publish a draft by email quickly, and then publish via the web interface. Some additional work would be necessary to have the tags execute…
<?php
/*
Plugin Name: Post By Email Customizations
Plugin URI: http://tylerdigital.com
Description: Handle Jetpack Post By Email – featured images, post formats, post content
Version: 1.0
Author: Tyler Digital
Author URI: http://tylerdigital.com
*/