Skip to content

Instantly share code, notes, and snippets.

View brichards's full-sized avatar

Brian Richards brichards

View GitHub Profile
@brichards
brichards / functions.php
Created January 31, 2013 17:27
New Option Defaults
<?php
// Set some new option defaults for our theme
function my_option_defaults( $defaults ) {
// Set some new options
$defaults['option_name'] = 'value';
$defaults['option_name'] = 'value';
$defaults['option_name'] = 'value';
@brichards
brichards / wp
Last active December 13, 2015 17:39
WP Commandline Local Install
#!/bin/bash
#
# WP Commandline Local Install, by Brian Richards (@rzen)
#
# Creates a new directory, downloads WordPress, creates a database, sets up wp-config,
# optionally empties wp-content, and deletes other misc files. This compliments my local
# dev setup, outlined here: http://rzen.net/development/local-develoment-in-osx/
#
# Credit:
# Based on WPBuildr (https://github.com/AaronHolbrook/wpbuildr/). Props to Aaron Holbrook
@brichards
brichards / wp-config.php
Created May 6, 2013 17:16
WP Debug Setup
<?php
// Enable WP_DEBUG mode
define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* This is forked from https://gist.github.com/luetkemj/2023628, just in case the original ever gets zapped
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
@brichards
brichards / bh_core.sublime-settings
Created June 11, 2013 13:41
BracketHighlighter Settings
{
//Debug logging
"debug_enable": false,
// Path to find icons at
"icon_path": "BracketHighlighter/icons",
// When only either the left or right bracket can be found
// this defines if the unmatched bracket should be shown.
"show_unmatched" : true,
@brichards
brichards / async-upload.php
Last active December 20, 2015 09:39
Dynamically-named Filter
<?php
/**
* Return the ID of the uploaded attachment of a given type
*
* @since 2.5.0
*
* @param int $id The uploaded attachment ID
*/
echo apply_filters("async_upload_{$type}", $id);
@brichards
brichards / wp-comments-post.php
Last active December 20, 2015 09:39
Typical Filter
<?php
/**
* The location to send commenter after posting
*
* @since 1.5.0
*
* @param string $location The 'redirect_to' URI sent via $_POST
* @param object The comment object
*/
@brichards
brichards / wp-signup.php
Last active December 20, 2015 09:39
Filter with an array param
<?php
/**
* Allow definition of default variables
*
* @since MU
*
* @param array $user_data The user data to define {
* @type string $user_name The username
* @type string $user_email The user's email
@brichards
brichards / wp-signup.php
Created July 30, 2013 00:01
Array-based filter
/**
* Allow definition of default variables
*
* @since MU
*
* @param array $user_data The user data to define {
* @type string "user_name" The username
* @type string "user_email" The user's email
* @type array "errors"
* }
@brichards
brichards / functions.php
Created August 5, 2013 15:22
Remove Support for StartBox Slideshows
<?php
// Disable support for SB Slideshows
function remove_sb_slideshows() {
remove_theme_support( 'sb-slideshows' );
}
add_action( 'after_setup_theme', 'remove_sb_slideshows' );