Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@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 / gist:1807863
Created February 12, 2012 10:56
Personalized Web (Chrome Plugin) settings for Github
#slider .frames .frame, .container { width: 1140px; }
.discussion-timeline { width: 1025px }
#inbox .list { width: 74em; }
.news { width: 775px; }
.columns.browser .main { width: 885px; }
@GaryJones
GaryJones / index.php
Created February 12, 2012 13:25
Recursive directory listing.
<?php
function recursive_dir_listing( $dir = '.', $maxlevel = 2, $level = 0 ) {
if ( $maxlevel == $level )
return;
$dirs = glob( $dir . '/*' , GLOB_ONLYDIR );
if ( ! $dirs )
@GaryJones
GaryJones / page_blog.php
Created February 15, 2012 21:51
Remove featured image on blog page posts that are in a specific category.
<?php
add_action( 'genesis_before_post' , 'wps_no_featured_image' );
add_action( 'genesis_after_post_content' , 'wps_no_featured_image' );
/*
* Remove featured image from certain posts.
*
* Stops featured image from displayed on the Small Group Show category (126) on
* the blog page.
*
@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 / gist:1869640
Created February 20, 2012 15:21
My Geek Code
-----BEGIN GEEK CODE BLOCK-----
Version: 3.20
GCS d- s: a31 c++ C+++ B-- 7---- w+ L+ M-- u++ W+++ H++++$ Z++
F+++ PS PE+ Y PGP T++ S J++++ R- m+ tv- b- DI- D
e++ h---- A+ r+++ y++++
------END GEEK CODE BLOCK------
@GaryJones
GaryJones / functions.php
Created February 23, 2012 13:21
Cache bust the style.css reference in WordPress.
<?php
add_filter( 'stylesheet_uri', 'gmj_stylesheet_uri' );
/**
* Cache bust the style.css reference.
*
* Includes the file last modified time as a querystring.
*
* @author Gary Jones
* @link https://gist.github.com/1892762
@GaryJones
GaryJones / functions.php
Created February 23, 2012 16:40
Add ref=menu querystring to each custom menu item
<?php
/**
* Add ref=menu querystring to each custom menu item, where "menu" is either the
* location the menu is assigned to, or the menu slug + ID number of the widget
* it is displayed with.
*
* @author Gary Jones
* @author Thomas Griffin
* @link https://gist.github.com/1893672
@GaryJones
GaryJones / gist:1901483
Created February 24, 2012 15:03
Media query sizes defined with meta tag.
<head>
<meta name="media" content="large=screen and (min-device-width:1024px)" />
<meta name="media" content="medium=screen and (min-device-width:640px and max-device-width:320px)" />
<meta name="media" content="tiny=screen and (max-device-width:320px)" />
<meta name="media" content="foo=print" />
</head>
<body>
<!-- whatever the decided content markup is, but referencing the meta values -->
<picture alt="...">
@GaryJones
GaryJones / functions.php
Created March 1, 2012 14:56
Fix category query tweak + sticky posts + is_home issue.
<?php
add_filter( 'posts_results','child_query_is_home' );
/**
* Fixes an issue where a query that targets a taxonomy stops sticky posts from working
* on is_home.
*
* The code suggests that sticky posts should only be on the blog archive (is_home) page.
* However, if that query is amended with an inclusive cat, tag or tax restriction, then
* WP doesn't count the query as being the blog archive page anymore.