Skip to content

Instantly share code, notes, and snippets.

View benhuson's full-sized avatar

Ben Huson benhuson

View GitHub Profile
@benhuson
benhuson / wp-config.php
Created April 1, 2014 16:49
Sample snippets for wp-config.php
<?php
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define( 'WP_DEBUG', true );
/* Nested Ordered List */
ol {
counter-reset: ol
}
li {
display: block
}
@benhuson
benhuson / my_plugin_row_meta.php
Created May 1, 2014 17:24
Add a link to your GitHub repo and translation link to your WordPress plugin.
<?php
/**
* Plugin Row Meta
*
* Adds GitHub and translate links below the plugin description on the plugins page.
* Replace references to 'my-plugin' to reflect your plugin folder and file name.
* Update the GitHub Repo and Translation links.
*
* @param array $plugin_meta Plugin meta display array.
@benhuson
benhuson / list-pages-shortcode-index.php
Last active August 29, 2015 14:04
List Pages Shortcode Index - Create alphabetically indexes using the List Pages Shortcode plugin (http://wordpress.org/extend/plugins/list-pages-shortcode/)
<?php
/*
Plugin Name: List Pages Shortcode Index
Plugin URI: https://gist.github.com/benhuson/9c419282d8e05fff6eeb
Description: Add-on for the <a href="https://wordpress.org/plugins/list-pages-shortcode/">List Pages Shortcode</a> plugin.
Author: Ben Huson
Version: 0.1
Author URI: https://github.com/benhuson
*/
@benhuson
benhuson / WordPress-jQuery
Created October 9, 2014 08:53
WordPress jQuery Tips
/**
* jQuery Wrapper
*/
( function( $ ) {
// Safe to use $
} )( jQuery );
{
"url": "http://example.com/json",
"rates": [
{
"name": "Belgium",
"code": "BE",
"periods": [
{
"effective_from": "1996-01-01",
"rates": {
@benhuson
benhuson / set-100-percent-height.js
Created January 8, 2015 13:40
100% height div across multiple browsers including mobile Safari.
/**
* 100% height div across multiple browsers including mobile Safari.
* http://www.ethanhackett.com/?blog=window-height-100-on-mobile-safari-coding-solution
*/
( function( $, window, undefined ) {
// First check to see if the platform is an iPhone, iPod, iPad (mobile Safari)
if ( /iP/.test( navigator.platform ) && /Safari/i.test( navigator.userAgent ) ) {
var mobileSafari = "Safari";
}
@benhuson
benhuson / jquery-plugin.js
Created April 8, 2015 20:54
jQuery Plugin Starter Template
( function( $ ) {
$.fn.helloWorld = function( options ) {
// Establish our default settings
var settings = $.extend( {
text : 'Hello, World!',
color : null,
fontStyle : null,
complete : null
@benhuson
benhuson / wpsc-vargrp-name-desc.php
Created June 2, 2015 18:00
Use WP eCommerce Variation Group description as name
<?php
/**
* WPSC Variation Group Name Display
*
* @param string $name Group name.
* @param WP_Term $group Group term object.
* @return string Group name.
*/
function my_wpsc_vargrp_name( $name, $group ) {
@benhuson
benhuson / js-function-exists-test.js
Created July 13, 2015 16:22
Check if JS Function Exists Before Calling
if ( typeof yourFunctionName == 'function' ) {
yourFunctionName();
}