Skip to content

Instantly share code, notes, and snippets.

View brettsmason's full-sized avatar

Brett Mason brettsmason

View GitHub Profile
<?php
/**
* Multiple checkbox customize control class.
*
* @since 1.0.0
* @access public
*/
class JT_Customize_Control_Checkbox_Multiple extends WP_Customize_Control {
/**
jQuery( document ).ready( function($) {
$( '.customize-control-checkbox-multiple > ul' ).sortable({
handle: '.dashicons-menu',
axis: 'y',
stop: function( event, ui ) {
checkbox_values = $( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]:checked' ).map(
function() {
return this.value;
}
.customize-control-checkbox-multiple .dashicons-menu {
float: right;
cursor: move;
}
.customize-control-checkbox-multiple li {
padding: 7px;
border: 1px solid #e5e5e5;
background: #fafafa;
}
@brettsmason
brettsmason / croft-svg.php
Last active December 9, 2016 03:42
SVG icon helper functions for WordPress
/**
* Return SVG markup.
*
* @param string $icon Required. Use the icon filename, e.g. "facebook-square".
* @param array $args {
* Parameters needed to display an SVG.
*
* @param string $title Optional. SVG title, e.g. "Facebook".
* @param string $desc Optional. SVG description, e.g. "Share this post on Facebook".
* @param string $class Optional. SVG class, defaults to 'icon icon-{icon name}.
@brettsmason
brettsmason / acf-gallery-remove-front-end-dependency.php
Created March 15, 2017 09:55
Remove Front-End Dependency for ACF Gallery Field Example (displays images with src, alt, width/height and caption)
@brettsmason
brettsmason / theme.js
Created June 19, 2017 19:16
Theme JS file
import whatInput from 'what-input';
window.$ = $;
import $ from 'jquery';
import { Foundation } from 'foundation-sites/js/foundation.core';
import { rtl, GetYoDigits, transitionend } from 'foundation-sites/js/foundation.util.core';
import { Box } from 'foundation-sites/js/foundation.util.box'
import { onImagesLoaded } from 'foundation-sites/js/foundation.util.imageLoader';
import { Keyboard } from 'foundation-sites/js/foundation.util.keyboard';
@brettsmason
brettsmason / primary-menu-search-form.php
Last active June 18, 2018 11:53
Add search form to a menu #PHP #WordPress
function primary_menu_search_form( $items, $args ) {
if ( $args->theme_location == 'primary' ) {
$search = '<li class="menu__item menu__item--search">' . get_search_form( false ) . '</li>';
return $items . $search;
}
}
add_filter( 'wp_nav_menu_items', __NAMESPACE__ . '\primary_menu_search_form', 10, 2 );
@brettsmason
brettsmason / WindowsSetup.md
Last active November 24, 2019 13:22 — forked from valeryan/WindowsSetup.md
Local WSL Setup

Windows Development Environment Setup

This document outlines the steps I take to setup my environment on windows using WSL. This requires being on the windows 10 Creative update or greater with an Ubuntu 16 installed as WSL.

Windows Setup Prerequisites

  1. Install WSL.
  2. Install Terminus and setup to use bash for windows (optional).
  3. Install Acrylic DNS Proxy.
  4. Download WSL Startup Scripts.
  5. Install Xming (optional).
@brettsmason
brettsmason / sym-woo-extensions.php
Created July 6, 2019 18:21 — forked from TheFeloniousMonk/sym-woo-extensions.php
WooCommerce - Display a list of variable products priced by a single or several variant states (attributes)
<?php
/**
* Plugin Name: SYM Woo Extensions
* Plugin URI: https://symphonyagency.com
* Description: A set of utilities for use with WooCommerce
* Version: 1.0.0
* Author: Chris Jenkins
* Author URI: http://symphonyagency.com
* License: GPL3
* Text Domain: sym-woo
@brettsmason
brettsmason / whitelist
Last active August 4, 2019 07:04
Mythic PurgeCSS whitelist
whitelist: [
'ltr',
'rtl',
'home',
'blog',
'archive',
'date',
'error-404',
'logged-in',
'admin-bar',