Skip to content

Instantly share code, notes, and snippets.

View JeffMatson's full-sized avatar
💭
<Something Clever>

Jeff Matson JeffMatson

💭
<Something Clever>
View GitHub Profile
add_filter( 'gform_webapi_authentication_required_post_form_submissions', '__return_true' );
array(
'name' => 'username',
'label' => 'Username',
'type' => 'field_select',
'default_value' => array(
'aliases' => array( 'user' )
)
)
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
function nb_autoload( $classname ) {
$class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower($classname) ) );
$file_path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $class . '.php';
if ( file_exists( $file_path ) ) {
require_once $file_path;
}
}
spl_autoload_register('nb_autoload');
@JeffMatson
JeffMatson / gist:a68cebd66cb34e31e7d0812038ce2147
Last active April 28, 2016 03:12
Nuke wc-cart-fragments
add_action( 'wp_print_scripts', 'nuke_cart_fragments', 100 );
function nuke_cart_fragments() {
wp_dequeue_script( 'wc-cart-fragments' );
return true;
}
@JeffMatson
JeffMatson / get-wp-colors.php
Last active February 11, 2016 19:47
Gets the colors in the current WordPress admin color scheme
function build_admin_colors() {
global $_wp_admin_css_colors;
$current_color_scheme = get_user_meta(get_current_user_id(), 'admin_color', true);
$colors = array_merge(
$_wp_admin_css_colors[$current_color_scheme]->colors,
$_wp_admin_css_colors[$current_color_scheme]->icon_colors
);
return $colors;
}
@JeffMatson
JeffMatson / get_actions.php
Last active February 7, 2016 16:54
Prints the actions fired in WordPress, and how many times
<?php
add_action( 'shutdown', function(){
foreach( $GLOBALS['wp_actions'] as $action => $count )
printf( '%s (%d) <br/>' . PHP_EOL, $action, $count );
});