Skip to content

Instantly share code, notes, and snippets.

View curtismchale's full-sized avatar

Curtis McHale curtismchale

View GitHub Profile
@johnpbloch
johnpbloch / gist:6029614
Created July 18, 2013 14:07
Remove a filter (or action) without a reference to an object
<?php
function remove_filter_by_classname( $filter, $classname, $priority ) {
global $wp_filter;
$match = false;
if( !empty( $wp_filter[$filter] ) && !empty( $wp_filter[$filter][$priority] ) ) {
foreach( $wp_filter[$filter][$priority] as $added_filter ) {
if( is_array( $added_filter['function'] ) && get_class( $added_filter['function'][0] ) === $classname ) {
$match = $added_filter;
break;

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

<?php
/*
Plugin Name: Log wp_mail()
Version: 0.1
Plugin URI: http://wsu.edu
Description: Log emails sent through WordPress to a text file.
Author: jeremyfelt, wsu.edu
*/
add_filter( 'wp_mail', 'wsu_log_wp_mail', 1 );
@kloon
kloon / deploy.sh
Last active December 4, 2020 14:05
Github to WordPress.org plugin repo deploy
#! /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="camptix-payfast-gateway"
CURRENTDIR=`pwd`
MAINFILE="camptix-payfast.php" # this should be the name of your main php file in the wordpress plugin
# git config
@curtismchale
curtismchale / Three Wise Monkeys.md
Last active November 12, 2021 20:15 — forked from malarkey/Three Wise Monkeys.md
The NDA I use.

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@tommcfarlin
tommcfarlin / complete-mobile-media-query-boilerplate.css
Last active July 22, 2018 06:57
A media query boilerplate for responsive design that covers iPhones, iPhone 5s, tablets, and iPads for viewing sites and applications in both portrait and landscape mode.
/**
* Note that the following media queries are intended to be used for the specified device or screen size
* in both portrait and landscape mode.
*
* Desktop queries are not provided since the default styles for most sites and applications typically focus
* on that for the default sites.
*
* Contributes, comments, and all that fun stuff always welcome :).
*/
@Melindrea
Melindrea / Gruntfile.js
Created October 29, 2013 20:39
PHP tasks for grunt
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// show elapsed time at the end
<?php
echo '<tr class="addon-file-field">';
echo '<th>';
echo '<label for="addon-file">'.__( 'ZIP file', '' ).'</label>';
echo '</th>';
echo '<td>';
echo '<input type="text" name="addon-meta[file]" id="addon-file" class="widefat" value="'.esc_url( $file ).'">';
echo '</td>';
echo '</tr>';
@mannieschumpert
mannieschumpert / gist:8888351
Last active February 22, 2021 05:02
Some filter examples for preventing editing of certain users.
<?php
/**
* Prevent Editing of a specified user
*
* This example shows how you can protect the original admin from being edited or deleted by anyone else
*/
add_filter('map_meta_cap', 'prevent_user_edit', 10, 4 );
function prevent_user_edit( $required_caps, $cap, $user_id, $args ){
$protected_user = 1; // ID of user not editable
/**
* Woo: Custom Download View
*
* Enable custom download box from plugin, if plugin is de-activated
* fallback to woocommerce default.
*/
function rapid_mydownloads( $template, $slug, $name ) {
if ( $template == 'myaccount/my-downloads.php' && function_exists( 'rapid_show_custom_download_box' ) ) {
global $woocommerce;
rapid_show_custom_download_box();