Skip to content

Instantly share code, notes, and snippets.

Matt Banks mattbanks

Block or report user

Report or block mattbanks

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
@mattbanks
mattbanks / functions.php
Last active Aug 29, 2015
Pre-WordPress 3.9 showing kitchen sink in WYSIWYG editor
View functions.php
<?php
add_filter( 'tiny_mce_before_init', 'mb_unhide_kitchensink' );
function mb_unhide_kitchensink( $args ) {
$args['wordpress_adv_hidden'] = false;
return $args;
}
@mattbanks
mattbanks / taxonomy-query-loop.php
Created Apr 2, 2014
Loop through each taxonomy term, run a new WP_Query in each term
View taxonomy-query-loop.php
<?php
// Get terms
// http://codex.wordpress.org/Function_Reference/get_terms
// use $args array in second parameter if needed
$my_categories = get_terms( 'TERM_NAME_HERE' );
$my_categories_count = count( $my_categories );
if ( $my_categories_count > 0 && is_array( $my_categories ) ) {
echo '<div class="wrap">';
@mattbanks
mattbanks / wp-setup.sh
Created Mar 14, 2014
Scaffold a new WordPress development site in Alfred, utilizing WP-CLI. Use this script to run as a Terminal Script. Customize for your theme needs, plugin needs, etc.
View wp-setup.sh
# Create directory for new site
cd ~/Sites
mkdir {query}
cd {query}
# Download latest version of WordPress
wp core download
# Setup wp-config file with WP_DEBUG enabled
wp core config --dbname={query} --dbuser=root --dbpass=root --dbprefix={query}wp_ --extra-php <<PHP
@mattbanks
mattbanks / gulpfile.js
Created Feb 4, 2014
Setup for using gulp in developing and deploying WordPress themes
View gulpfile.js
// Load plugins
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')({ camelize: true }),
lr = require('tiny-lr'),
server = lr();
// Styles
gulp.task('styles', function() {
return gulp.src('assets/styles/source/*.scss')
.pipe(plugins.rubySass({ style: 'expanded', compass: true }))
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :private_network, ip: "192.168.204.72"
config.ssh.forward_agent = true
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--memory", 1024]
@mattbanks
mattbanks / Gruntfile.js
Created Sep 9, 2013
Grunt LiveReload issue - package.json and Gruntfile.js
View Gruntfile.js
'use strict';
module.exports = function(grunt) {
// load all grunt tasks matching the `grunt-*` pattern
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// watch for changes and trigger compass, jshint, uglify and livereload
watch: {
@mattbanks
mattbanks / Gruntfile.js
Last active Dec 22, 2015
Grunt Setup with LESS
View Gruntfile.js
'use strict';
module.exports = function(grunt) {
// load all grunt tasks matching the `grunt-*` pattern
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// watch for changes and trigger compass, jshint, uglify and livereload
watch: {
@mattbanks
mattbanks / mb_html5_doctype.php
Last active Dec 21, 2015
Adding Conditional Classes to the HTML Tag in Genesis 2.0
View mb_html5_doctype.php
/**
* HTML5 DOCTYPE
* removes the default Genesis doctype, adds new html5 doctype with IE8 detection
*/
function mb_html5_doctype() {
?>
<!DOCTYPE html>
<!--[if IE 8]> <html class="lt-ie9" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if gt IE 8]><!--> <html <?php language_attributes( 'html' ); ?>> <!--<![endif]-->
@mattbanks
mattbanks / php-expires-headers.php
Created Aug 15, 2013
PHP no caching expires headers
View php-expires-headers.php
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
You can’t perform that action at this time.