Skip to content

Instantly share code, notes, and snippets.

Thomas Griffin thomasgriffin

Block or report user

Report or block thomasgriffin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thomasgriffin
thomasgriffin / gf-entry-highlighting.php
Created Oct 4, 2011
Gravity Forms admin entry row highlighting
View gf-entry-highlighting.php
<?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 )
View gist:1265154
foreach ( $this->plugins as $plugin )
add_option( TGMPA_SETTINGS, array( "tgmpa_dismiss_{$plugin['slug']}" => 1 ) );
View gist:1268010
/** 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
View gist:1805337
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' ) );
}
View gist:1805507
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>';
}
View gist:1805593
public static function singleton() {
if ( ! isset( self::$instance ) )
self::$instance = new __CLASS__;
return self::$instance;
}
View gist:1818526
add_filter( 'tgmsp_output_meta_fields', 'remove_certain_fields' );
function remove_certain_fields( $fields ) {
unset( $fields['alt'] );
return $fields;
}
View gist:1849495
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,
View gist:1893164
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>';
}
View gist:1893183
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 );
You can’t perform that action at this time.