Skip to content

Instantly share code, notes, and snippets.

@morganestes
morganestes / wp-deprecated.php
Last active August 29, 2015 13:56
How to include deprecated functions in older versions of WordPress but not in newer ones.
<?php
/* screen_icon was deprecated in 3.8 */
if ( version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ) {
screen_icon();
}
@morganestes
morganestes / .instructions.md
Last active August 29, 2015 13:57
Navigation based on the page used
  • Create a new PHP file named page-yourcustomnamehere.php.
  • Add /* Template Name: Your Custom Name */ in the top. This name is what you look for in the editor.
  • Add your code (feel free to copy from page.php or index.php and change it to what you need.
  • Create your nav menu and add it to nav.php
  • Create a custom menu and add it to nav-yourcustomnamehere.php
  • Add the code in custom-nav-caller.php example file to where you want your nav to go inside page-yourcustomnamehere.php.

The code looks for a file named nav-{$whatever}.php, where $whatever is the slug of your file. If it exists, it'll include that file. If not, it falls back to nav.php, so it's important that that file exists.

@morganestes
morganestes / me-add-svg-support.php
Last active August 29, 2015 13:58
Add SVG support to a WordPress installation so images display properly in admin pages. https://core.trac.wordpress.org/ticket/26591
<?php
/**
* Plugin Name: Add SVG Support
* Plugin URI: https://gist.github.com/morganestes/10066447
* Description: Adds SVG support to the `.htaccess` file so Chrome displays images in Admin correctly.
* Version: 0.1.0
* Author: Morgan Estes
* Author URI: http://www.morganestes.me
* License: GPLv2
*/
@morganestes
morganestes / !what.md
Last active August 29, 2015 13:59
Fun SPAM emails I receive

I get quite a bit of spam, even though my host has a filter installed. These are some of the better ones that get through.

#!/bin/bash
#
# Get a list of props from the log and search for a given name.
#
# Example: add `getprops <name>` to the end of this file and run
# `$ ./propslog.sh` from the command line.
#
# You can also add this to your ~/.functions file and use
# `getprops <name>` inside your local WordPress Core repo.
#

Keybase proof

I hereby claim:

  • I am morganestes on github.
  • I am morganestes (https://keybase.io/morganestes) on keybase.
  • I have a public key whose fingerprint is FEC6 4E0B 7773 7647 FA0C 5B34 BB57 9336 DD3E FAB9

To claim this, I am signing this object:

@morganestes
morganestes / adb-tools.sh
Created June 10, 2014 21:23
Android command-line tools for OS X.
# Android helpers
alias phonescreencap="adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png"
# Creates a full backup using adb.
function phonebackup(){
local timestamp=$(date "+%Y%m%dT%H%M%S")
local phoneserial=$(adb get-serialno)
adb backup -apk -shared -all -f "${HOME}/temp/villebackup/${phoneserial}-backup-${timestamp}.ab"
}
<?php
/*
Plugin Name: Golf Tailor Offers
Plugin URI: http://code.golftailor.com/
Description: Create an Offers Custom Post Type for use in sales pages.
Version: 0.1.0
Author: morganestes
Author URI: http://www.golftailor.com
Text Domain: golftailor
*/
<!DOCTYPE html>
<!--[if IE 6]>
<html itemscope itemtype="http://schema.org/Article" id="ie6" lang="en-US" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#" itemscope itemtype="http://schema.org/WebPage" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:addthis="http://www.addthis.com/help/api-spec" >
<![endif]-->
<!--[if IE 7]>
<html itemscope itemtype="http://schema.org/Article" id="ie7" lang="en-US" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#" itemscope itemtype="http://schema.org/WebPage" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:addthis="http://www.addthis.com/help/api-spec" >
<![endif]-->
<!--[if IE 8]>
<html itemscope itemtype="http://schema.org/Article" id="ie8" lang="en-US" prefix="og: http://ogp.me/ns
@morganestes
morganestes / xylitol.html
Created August 6, 2014 20:11
xylitol exploit page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Cyber-doigt : 30,403 victimes par Xylitol</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Description" content="Vous aussi, comme Xylitol envoyez et recevez des Cyber-doigts dans le c** rien que pour rire..." />
<meta name="Keywords" content="cyber doigt, doigt, cyberdoigt, Xylitol, humour, blague, rire, rigoler, amis" />
<meta name="robots" content="noindex, follow">
<meta http-equiv="Content-Language" content="fr" />
<link href="/css/cyberdoigt.css" rel="stylesheet" type="text/css" />