Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@GaryJones
GaryJones / gist:1517555
Created December 24, 2011 15:26
Display some widgets from a sidebar in random order
<?php
add_filter( 'sidebars_widgets', 'gmj_shuffle_widgets' );
/**
* Shuffle ranges of widgets within a sidebar.
*
* Hat-tip to {@link http://gmj.to/op} for the original idea.
*
* @uses gmj_do_shuffle_widgets() Does the actual array manipulation.
*
@GaryJones
GaryJones / gist:1517997
Created December 24, 2011 18:18
Add content to the top of each sidebar on the Widgets admin screen.
<?php
add_action( 'dynamic_sidebar', 'gmj_add_content_to_top_of_sidebars_on_widgets_screen' );
/**
* Add content to the top of each sidebar on the Widgets admin screen.
*
* @author Gary Jones
*
* @global array $wp_registered_widgets All registered widgets
* @param array $current_widget The current widget about to have its form shown
@GaryJones
GaryJones / gist:1518465
Created December 24, 2011 22:24
Add new option to Genesis Content Archives display dropdown, and amend the toggles config to also show the Limit setting if the new value is chosen. Requires Genesis 1.8.0 to work, since neither filter existed until then.
<?php
add_filter( 'genesis_archive_display_options', 'child_add_content_archive_display_option' );
/**
* Adds new option to display type in Genesis Theme Settings Content Archives
* box.
*
* @param array $options Existing display types.
* @return array Amended display types.
*/
@GaryJones
GaryJones / gist:1547745
Created January 1, 2012 16:45 — forked from billerickson/gist:1547518
Increase post count to 20 - Right Way
<?php
add_action( 'pre_get_posts', 'be_increase_posts_on_quotes_archive' );
/**
* Increase posts on quotes archive.
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
*
@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.
*
*/
@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:1653664
Created January 21, 2012 19:26
WP Simple Maintenance Mode
<?php
/**
* WP Simple Maintenance Mode plugin
*
* Shows site in maintenance mode unless on the login page or one of a
* selected group of users.
*
* Revamp of http://pastebin.com/tK6YnfyS
*
* @package WP_Simple_Maintenance_Mode
@GaryJones
GaryJones / functions.php
Last active September 30, 2015 01:17
Split Sidebar in Genesis - http://gamajo.com/split-sidebar-genesis
<?php
// Don't include the <?php above
add_action( 'after_setup_theme', 'prefix_register_split_sidebars', 5 );
/**
* Register the two widget areas that make up our visually separated sidebar.
*
* @author Gary Jones
* @link http://gamajo.com/split-sidebar-genesis
@GaryJones
GaryJones / .htaccess
Created January 29, 2012 11:22
Fix for HTTP Error as seen in WP Media Uploader
php_value memory_limit "128M"
#BEGIN Image Upload HTTP Error Fix
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
<IfModule security_module>
@GaryJones
GaryJones / gist:1698372
Created January 29, 2012 11:25
WordPress Theme Tags
Tags: black, blue, brown, gray, green, orange, pink, purple, red, silver, tan, white, yellow, dark, light, one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, fixed-width, flexible-width, blavatar, buddypress, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-image-header, featured-images, front-page-post-form, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready, holiday, photoblogging, seasonal