Skip to content

Instantly share code, notes, and snippets.

retlehs /
Last active Jan 26, 2022
WP-CLI aliases sync example
read -r -p "Would you really like to reset your development database and pull the latest from production? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
wp @development db reset --yes &&
wp @production db export - > sql-dump-production.sql &&
wp @development db import sql-dump-production.sql &&
wp @development search-replace
View wordpress.patch
diff U3 a/wp/wp-includes/load.php b/wp/wp-includes/load.php
--- a/wp/wp-includes/load.php Tue Feb 02 19:38:52 2016
+++ b/wp/wp-includes/load.php Tue Feb 02 19:58:21 2016
@@ -285,7 +285,7 @@
function wp_debug_mode() {
if ( WP_DEBUG ) {
- error_reporting( E_ALL );
+ error_reporting( E_ALL & ~E_DEPRECATED );
retlehs / gist:e5683cb8377e1b1836ab
Created May 26, 2015
Don't be scared of Sage
View gist:e5683cb8377e1b1836ab

This is from a comment on the Advanced WordPress Facebook group by Kevin Hoffman.

Disclaimer: I'm not affiliated with Roots, just a satisfied user.

In response to several recent questions on the topic of starter themes, the following are my thoughts on what I believe is the best starter theme available today, along with a heads-up on an upcoming resource that may help you in the near future.

Recommendations for starter themes come up quite often in AWP, and my first instinct is to recommend Roots' Sage starter theme (, but to be honest, it's not for everyone. I feel like I always have to attach the caveat concerning the prerequisites: Node.js, gulp, Bower, CSS preprocessing, build processes, etc. I often see advanced devs discouraging others from trying Sage if they're not 100% up to date on all of these tools. Don't let that scare you.

retlehs / header.php
Created Apr 29, 2015
Sage header template for Bootstrap top navbar component
View header.php
// This file assumes that you have included the nav walker from
// somewhere in your theme.
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
retlehs / gist:01477d70c01f50a87553
Created Apr 14, 2015
Enable test mode for Easy Digital Downloads if you're not on production
View gist:01477d70c01f50a87553
* If not on production, enable test mode for Easy Digital Downloads
add_action('edd_is_test_mode', function() {
return WP_ENV !== 'production';

After reading through this guide, you will:

  • Understand the Roots Wrapper and recognize how it extends and complements the WordPress template hierarchy.
  • Know what is meant by the DRY Principle, why being DRY bests being WET, and see how most WordPress themes are WET.
  • Be able to filter the Roots Wrapper and create a new base template for a Custom Post Type.

Template Hierarchy

WordPress is pretty smart. Every time you load up a request it will search for the most relevant template available in your theme and load it. This is the Template Hierarchy in action and it enables us to easily customize the appearance of our sites.

retlehs / gist:4120053
Created Nov 20, 2012
Remove unnecessary markup from WooCommerce
View gist:4120053
* Remove unnecessary markup from WooCommerce:
* 1. Remove <meta name="generator" content="WooCommerce (version)" />
* 2. Remove the addition of <body class="theme-themename">
function woocommerce_head_cleanup() {
global $woocommerce;
retlehs / gist:2785401
Created May 25, 2012
Display YouTube thumbnail from embed URL
View gist:2785401
* Display a thumbnail from YouTube based off the embed code saved in the
* video post format metabox used by the CF Post Formats plugin
* @link
* @link
global $post;
retlehs / gist:2703644
Created May 15, 2012
Add a class to widgets in a specific sidebar
View gist:2703644
* Add 'class="span4"' to all widgets in the Content Bottom sidebar
function bb_content_bottom_widget_class($params) {
if ($params[0]['id'] == 'roots-content-bottom') {
$class = 'class="span4 ';
$params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1);
retlehs / autoexec.cfg
Created Jan 7, 2012
ra3 autoexec.cfg
View autoexec.cfg
// f27-ben (
// 01.07.2012
// quake3 ra3
cg_fov 106
cg_chatbeep 0
cg_simpleitems 1
cg_noProjectileTrail 1
cg_drawGun 0
cg_autoswitch 0