Skip to content

Instantly share code, notes, and snippets.

Ryan Duff ryanduff

Block or report user

Report or block ryanduff

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
View rewrite.php
<?php
add_filter( 'post_type_link', 'post_type_links', 10, 4 );
/**
* Generates custom permalink structures
*
* @since 1.0.0
*
* @param string $permalink Current permalink
* @param object $post Current post object
View term-edit.php
<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'cmb_edit_term' );
function cmb_edit_term() {
echo '<article class="entry">';
$taxonomy_name = get_query_var( 'taxonomy_name', false );
@ryanduff
ryanduff / gist:7681246
Created Nov 27, 2013
Deactivate plugins on each site in multisite. Drop in wordpress root directory. Assumes wp-config.php is in same directory. Props @kovshenin for the concept http://kovshenin.com/2012/how-to-network-deactivate-a-wordpress-plugin/
View gist:7681246
<?php
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
require( 'wp-config.php' );
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
global $wpdb;
$blogs = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs;" );
View gist:6285885
<?php
//USAGE
$semantics3 = biffleSemantics3::get_instance( $query );
$raw = $semantics3->get_product_search('products');
class biffleSemantics3 {
/*
Documentation
https://www.semantics3.com/docs/
View gist:6252657
<?php
function log_it( $logme ) {
$log = WP_CONTENT_DIR . '/log_it.log';
file_put_contents( $log, print_r( $logme, true ), FILE_APPEND );
}
View canttouchthis.php
<?php
function cant_touch_this() {
echo 'Stop, Hammer Time!';
}
add_action( 'init', 'cant_touch_this', (string) PHP_INT_MAX . rand(1, 1000) );
View gist:6065923
<?php
/**
* Infinite Scroll on the Homepage
*
* Display posts until the end of time
*
* @package WordPress
* @subpackage Lossip
* @since Lossip 1.0
*/
@ryanduff
ryanduff / gist:6059052
Created Jul 23, 2013
Autocomplete for your local dev folder. Specify that path on line 2
View gist:6059052
#Local Dev folder
LOCAL_DEV_FOLDER=$HOME/Dropbox/Projects/Local\ Dev
#Local Dev alias
ldev() {
cd $LOCAL_DEV_FOLDER/$1;
}
_ldev() {
local cur
@ryanduff
ryanduff / gist:6030199
Created Jul 18, 2013
Spammy email pretending to be military
View gist:6030199
Hi ,
My name is Sgt. John Samuel US ARMY serving the World and my country in the most honorable way I
know I can, in AFGHANISTAN right now, in a nutshell, I am an American soldier serving in the Military with
the Army 3rd infantry division. With a very desperate need for assistance,I found your contact particulars
during my email search and picked up courage to contact you for your assistance.
Some money in various currencies were discovered in a room at a farm house near one of Osama Bin Laden's
old house in Kabul-Afghanistan during a rescue operation, I happened to be one of the soldiers that led that
operation that day, so it was agreed by Col. William E. Cole the head of our battalion that some part of this
@ryanduff
ryanduff / gist:5769953
Last active Dec 18, 2015
Delete orphaned terms that aren't in a taxonomy. (this will only clear the terms table)
View gist:5769953
-- Replace %s with table prefix
DELETE t
FROM %s_terms t
LEFT JOIN %s_term_taxonomy tt ON tt.term_id = t.term_id
WHERE tt.term_id IS NULL
You can’t perform that action at this time.