Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block dalethedeveloper

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
dalethedeveloper / gist:6511417
Created Sep 10, 2013
Override jQuery Mobile page change/show methods to hack in support for #anchor links in the content fragment loaded. Tested with JQM 1.2 to 1.3.2.
View gist:6511417
<script src=""></script>
if (window.location.hash == '#_=_') // Darn it, Facebook
window.location.hash = '';
$(document).bind("mobileinit", function(){
// Enable anchor links to behave like you think they would
var selector = 'a[name="'+($(this).attr('href').substring(1))+'"]',
dalethedeveloper / gist:5826076
Created Jun 20, 2013
WP Network Site Move SQL
View gist:5826076
-- Make sure ZZZ is the number of the site in the `wp_sites` table. Your root site has no entry so it would be `wp_posts`
-- but your first site in the Network Admin > Sites list would be `wp_1_posts`
-- OLDSITE.TLD and NEWSITE.TLD should be complete FQDNs. If a site was make sure you replace it
-- completely so that you don't end up with
UPDATE wp_ZZZ_postmeta SET meta_value = replace(meta_value,'OLDSITE.TLD','NEWSITE.TLD') WHERE meta_value like '%OLDSITE.TLD%';
UPDATE wp_ZZZ_posts SET guid = replace(guid, 'OLDSITE.TLD','NEWSITE.TLD');
UPDATE wp_ZZZ_posts SET post_content = replace(post_content, 'OLDSITE.TLD','NEWSITE.TLD');
-- Close comments on all existsing posts and pages
UPDATE wp_ZZZ_posts SET ping_status = 'closed', comment_status = 'closed' WHERE post_type IN ('post,'page');
dalethedeveloper / gist:5701586
Created Jun 3, 2013
As see on JSFiddle! A jQuery Plugin to perform sorting tricks on class based collections of items with AND logic for multiple groups.
View gist:5701586
<!DOCTYPE html>
.event_wrap {border: 1px solid #ddd; padding: 10px;margin: 20px}
span.clear-filter {text-decoration:underline;background-color:blue;cursor:pointer;color:white;margin-left:5px}
.current-tax {font-weight:bold}
<script type="text/javascript" src=""></script>
(function ($) {
dalethedeveloper / gist:5605660
Last active Dec 17, 2015
I FORGOT MY WORDPRESS PASSWORD (But I still have write access to the theme files)
View gist:5605660
If you don't know a user_id of an admin, find one with $wpdb->query():
SELECT user_id,meta_value FROM {$wpdb->prefix}usermeta WHERE meta_key = 'nickname'
AND user_id IN
(SELECT user_id FROM {$wpdb->prefix}usermeta WHERE meta_value LIKE '%administrator%');
| user_id | meta_value |
dalethedeveloper /
Last active Feb 21, 2017
Transferring to/from Gmail accounts to a Google Apps account with imapsync. Also good for GApps to GApps transfers, archives, or migrations.
# Most of the tweaks here are wrapped up in gmailmig
# Props to brave folks who figured this out before me
dalethedeveloper / upgrade-permalinks.php
Last active Dec 16, 2015
WordPress Plugin - clear permalinks on Network Upgrade. If you have sites on a WP Network (formerly WPMU) that use custom permalink structures or certain configurations of Custom Post Types it may be necessary to flush permalinks. This hack lets you do that safely across the entire network. Add this file to /wp-content/mu-plugins/ or as a enable…
View upgrade-permalinks.php
dalethedeveloper / gist:5469023
Created Apr 26, 2013
WordPress Sidebar Example, pulling in one level of Child Pages for navigation. Mimics typical Sidebar Widget classes.
View gist:5469023
global $post;
$which_parent = empty($post->post_parent) ? get_the_ID() : $post->post_parent;
if( is_page() and get_children('post_status=publish&post_type=page&numberposts=1&post_parent='.$which_parent) ):
<li id="widget-child-nav" class="widget">
<a href="<?php echo get_permalink($which_parent); ?>">
<h2 class="widgettitle"><?php echo get_the_title($which_parent); ?> Menu</h2>
dalethedeveloper / gist:5257672
Created Mar 27, 2013
jQuery Mobile - implement anchor links in existing HTML with scrollTo Written specifically against 1.2.0 functionality of "pagechange" event after enhancements have taken place.
View gist:5257672
var selector = 'a[name="'+($(this).attr('href').substring(1))+'"]',
target = $(selector).get(0).offsetTop;
return false;
dalethedeveloper / gist:5041690
Last active Dec 14, 2015 — forked from anonymous/gist:5041678
Enable debugging on a WordPress site for your session only. Uses a simple URL Variable thats only security is obscurity. Replaces existing WP_DEBUG definition in your wp-config.php
View gist:5041690
// Replace existing definition in your wp-config.php
// define('WP_DEBUG',false);
if( !isset($_COOKIE['likeaboss']) and isset($_GET['likeaboss']) )
setcookie('likeaboss',($_GET['likeaboss']=='fosho'?'fosho':false), time()+3600);
define('WP_DEBUG',((isset($_COOKIE['likeaboss']) and $_COOKIE['likeaboss']=='fosho')?true:false));
// Drop ?likeaboss=fosho on your URL to enable WP_DEBUG for a bit
dalethedeveloper / gist:4656838
Created Jan 28, 2013
Rollback WordPress 3.5's jQuery version to 1.7.2 for plugins that haven't been migrated to 1.8.3 yet. Be aware there may be unintended consequences of using this, particularly in the WP Admin. You will need to call jQuery.noConflict() early as well ref:
View gist:4656838
function rollback_jquery() {
You can’t perform that action at this time.