Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
<?php
// Register widget area
genesis_register_sidebar( array(
'id' => 'sample',
'name' => __( 'Sample', 'your-child-theme-text-domain' ),
'description' => __( 'This is the sample widget area description.', 'your-child-theme-text-domain' ),
) );
@GaryJones
GaryJones / functions.php
Last active December 10, 2015 01:18
WordPress: Add new featured image sizes.
<?php
// Add new featured image sizes
add_image_size( 'home-bottom', 150, 100, true );
add_image_size( 'home-top', 400, 200, true );
@GaryJones
GaryJones / functions.php
Created May 25, 2012 10:04 — forked from rogierborst/gist:2786753
Using the template_include filter in WordPress
<?php
add_filter( 'template_include', 'ja_template_include' );
/**
* Apply a template to all subcategories of a certain parent category.
*
* @author Rogier Borst
* @author Gary Jones
* @author Jared Atchison
*
* @link https://gist.github.com/gists/2787095 Current version
@GaryJones
GaryJones / gist:2437195
Created April 21, 2012 13:55 — forked from miklb/gist:2437076
WordPress redirect single search result
<?php
add_action( 'template_redirect', 'kkf_single_search_redirect' );
/**
* If only one search result match, automatically redirect to that result.
*
* @author Michael Bishop
* @link https://gist.github.com/2437076
*
* @global WP_Query $wp_query Query object.
@GaryJones
GaryJones / front.php
Created February 16, 2012 17:17
Live Toolbar
<?php
/**
* Create the Live Toolbar.
*
* @since 1.0.0
*/
function radio_live_toolbar() {
@GaryJones
GaryJones / functions.php
Created February 12, 2012 04:01 — forked from billerickson/functions.php
Genesis Grid Loop Advanced
<?php
/**
* Possibly amend the loop.
*
* Specify the conditions under which the grid loop should be used.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
@GaryJones
GaryJones / functions.php
Created February 11, 2012 12:20 — forked from billerickson/widget nav.php
Add widget area before primary menu items in Genesis.
<?php
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
/**
* Adds a widget area before primary menu items.
*
* @author Bill Erickson
* @author Gary Jones
* @link https://gist.github.com/gists/1799174
@GaryJones
GaryJones / functions.php
Created February 10, 2012 12:03 — forked from billerickson/functions.php
Genesis Grid Loop - Parts 1-3
<?php
/**
* Possibly amend the loop.
*
* Specify the conditions under which the grid loop should be used.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
@GaryJones
GaryJones / gist:1612938
Created January 14, 2012 21:20 — forked from billerickson/gist:1612826
Sort specific category to display alphabetically.
<?php
add_action( 'pre_get_posts', 'be_sort_articles_category' );
/**
* Sort 'articles' category by name
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
@GaryJones
GaryJones / gist:1547753
Created January 1, 2012 16:48 — forked from billerickson/gist:1547637
Create session metaboxes
<?php
add_action( 'init', 'be_initialize_meta_boxes' );
/**
* Initialize the metabox code library.
*
* Since this code might be in the theme and multiple plugins,
* see if it exists already before initializing it.
*
*/