Skip to content

Instantly share code, notes, and snippets.


Chad Butler butlerblog

View GitHub Profile
butlerblog / find_callback.php
Last active Jul 19, 2021
#utility for finding callback functions hooked to a specific hook
View find_callback.php
<?php // do not use this line. Add below to functions.php
add_action( 'wp_footer', 'list_hooked_filters_and_actions' );
add_action( 'login_footer', 'list_hooked_filters_and_actions' );
add_action( 'admin_footer', 'list_hooked_filters_and_actions' );
function list_hooked_filters_and_actions() {
global $wp_filter;
butlerblog / woocommerce-settings-tab-demo.php
Last active Nov 24, 2021 — forked from BFTrick/woocommerce-settings-tab-demo.php
A plugin demonstrating how to add a #WooCommerce settings tab.
View woocommerce-settings-tab-demo.php
* Plugin Name: WooCommerce Settings Tab Demo
* Plugin URI:
* Description: A plugin demonstrating how to add a WooCommerce settings tab.
* Author: Patrick Rauland
* Author URI:
* Version: 1.0
* This program is free software: you can redistribute it and/or modify
butlerblog / wp_mail_bcc.php
Last active Jul 19, 2021
#wp_mail add bcc based on contents of subject line
View wp_mail_bcc.php
<?php // DO NOT include this line. Add below to your theme functions.php
* Add bcc address to email based on contents
* of the email subject line.
* Set email address and content of the subject
* line for the email being filtered.
add_filter( 'wp_mail', 'custom_mails' );
butlerblog / custom-queries.php
Created Nov 22, 2018 — forked from carlodaniele/custom-queries.php
An example plugin showing how to add custom query vars, rewrite tags and rewrite rules to WordPress
View custom-queries.php
* @package Custom_queries
* @version 1.0
Plugin Name: Custom queries
Plugin URI:
Description: This is an example plugin
Author: Carlo Daniele
butlerblog / columns.css
Created Nov 14, 2018 — forked from studiopress/columns.css
Genesis column classes.
View columns.css
/* Column Classes
--------------------------------------------- */
butlerblog / 0.php
Last active Nov 12, 2018
How to use anonymous functions for simple filters
View 0.php
* This gist is example code that goes with an article on how (and why/when) to use
* PHP anonymous functions. To view the entire post, go to:
butlerblog / mc_put_req.php
Last active Nov 24, 2021
#Mailchimp list subscribe "put" request
View mc_put_req.php
* Utility function to subscribe a user to a MailChimp
* list using the MC API 3.0
* @param array $args {
* Array of settings.
* @type string $api_key Your MailChimp API key.
butlerblog / header_overlap_fix.css
Created Nov 5, 2018
Fix header overlap with anchor links (Genesis)
View header_overlap_fix.css
:target::before {
content: "";
display: block;
height: 50px; /* fixed header height*/
margin: -50px 0 0; /* negative fixed header height */
butlerblog / my_get_plugin_info.php
Last active Apr 12, 2022
#utility to get plugin info
View my_get_plugin_info.php
<?php // no need to use this line.
* Utility to get information on installed plugins.
* Returns an array of all installed plugins and indicates which are
* plugin are active and which are not. Array is keyed by the plugin's
* folder/slug.php (which is how WP looks at them) and includes the
* name, version, and true/false whether it is active or not.
butlerblog / create_field_label_orig.php
Last active Aug 14, 2018
Code for description of adding label tags to radio field type items
View create_field_label_orig.php
* Create form label.
* @since 3.1.7
* @param array $args {
* @type string $meta_key
* @type string $label_text