Skip to content

Instantly share code, notes, and snippets.

View thomasgriffin's full-sized avatar
👋

Thomas Griffin thomasgriffin

👋
View GitHub Profile
@thomasgriffin
thomasgriffin / gf-entry-highlighting.php
Created October 4, 2011 12:07
Gravity Forms admin entry row highlighting
<?php
/* Use jQuery to target rating areas and add classes
------------------------------------------------------------ */
add_action( 'admin_print_scripts', 'tgm_target_colors', 20 );
function tgm_target_colors() {
global $current_screen;
if ( 'forms_page_gf_entries' !== $current_screen->id )
@thomasgriffin
thomasgriffin / gist:1265154
Created October 5, 2011 17:54
foreach issue
foreach ( $this->plugins as $plugin )
add_option( TGMPA_SETTINGS, array( "tgmpa_dismiss_{$plugin['slug']}" => 1 ) );
/** Set type, based on whether the source starts with http:// or https:// */
$type = preg_match('|^http(s)?://|', $plugin['source'] ) ? 'web' : 'upload';
/** Prefix a default path to pre-packaged plugins */
$source = ( 'upload' == $type ) ? $this->default_path . $plugin['source'] : $plugin['source'];
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) ); // Create a new instance of Plugin_Upgrader
$upgrader->install( $source ); // Perform the action and install the plugin from the $source URL
add_action( 'init', 'remove_stuff' );
function remove_stuff() {
if ( class_exists( 'TGM_Soliloquy' ) )
remove_action( 'tgmsp_soliloquy_settings', array( TGM_Soliloquy::$instance, 'output_soliloquy_plugin_settings' ) );
}
add_action( 'admin_notices', 'check_objects' );
function check_objects() {
echo '<pre>' . print_r( TGM_Soliloquy::$instance, true ) . '</pre>';
$test = new TGM_Soliloquy;
echo '<pre>' . print_r( $test, true ) . '</pre>';
}
public static function singleton() {
if ( ! isset( self::$instance ) )
self::$instance = new __CLASS__;
return self::$instance;
}
add_filter( 'tgmsp_output_meta_fields', 'remove_certain_fields' );
function remove_certain_fields( $fields ) {
unset( $fields['alt'] );
return $fields;
}
function nirvana_install() {
global $wpdb;
$table = 'dynamic_sidebars';
$dynamic_sidebars = $wpdb->prefix . $table;
$sql = $wpdb->prepare( "CREATE TABLE $dynamic_sidebars (
dynamic_sidebar_id BIGINT(20) NOT NULL AUTO_INCREMENT,
sidebar_name VARCHAR(255) NOT NULL,
sidebar_id VARCHAR(255) NOT NULL,
add_filter( 'wp_nav_menu_objects', 'tgm_filter_nav_menu', 10, 2 );
function tgm_filter_nav_menu( $objects, $args ) {
echo '<pre>' . print_r( $objects, true ) . '</pre>';
echo '<pre>' . print_r( $args, true ) . '</pre>';
}
add_filter( 'wp_nav_menu_args', 'tgm_custom_nav_menu_args' );
function tgm_custom_nav_menu_args( $args ) {
$args['unique'] = $args['theme_location'];
return $args;
}
add_filter( 'wp_nav_menu_objects', 'tgm_filter_nav_menu', 10, 2 );