Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@rmccue
rmccue / plugin-file.php
Created January 17, 2012 12:27 — forked from kovshenin/plugin-file.php
Improved class concept
<?php
/*****
All new versions will be posted at
https://github.com/rmccue/Rotor_WPPlugin
Please use that repository instead of this Gist.
******/
@billerickson
billerickson / functions.php
Created February 9, 2012 15:42 — forked from GaryJones/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
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*/
function child_maybe_do_grid_loop() {
@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; }
@miklb
miklb / gist:2437076
Created April 21, 2012 13:28
WordPress redirect single search result
/*If only one search result match, redirect to that page */
function kkf_singlesearch_redirect() {
if (is_search()) {
global $wp_query;
if ($wp_query->post_count == 1) {
wp_redirect( get_permalink( $wp_query->posts['0']->ID ) );
}
}
}
@flashingcursor
flashingcursor / gist:3259590
Created August 4, 2012 19:55
Change "Enter Title Here" text in WordPress Custom Post Types
<?php
add_filter( 'enter_title_here', 'hwp_enter_title_here' );
function hwp_enter_title_here( $title ){
$screen = get_current_screen();
if ( 'custom_post_type' == $screen->post_type ) {
$title = 'Custom Post Type Title Text';
}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@spivurno
spivurno / gw-gravity-forms-better-pre-submission-confirmation.php
Last active September 23, 2022 15:50
Gravity Wiz // Gravity Forms // Better Pre-submission Confirmation
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-better-pre-submission-confirmation.php
*/
/**
* Better Pre-submission Confirmation
* http://gravitywiz.com/2012/08/04/better-pre-submission-confirmation/
*/
@stubbornella
stubbornella / css-stats-ack.sh
Created October 1, 2012 22:07 — forked from pjkix/css-stats-ack.sh
shell script to generate some css file statistics
#!/bin/bash
## v1.0.6
## this script will gernerate css stats
### example output
# CSS STATS
# ----------
# Floats: 132
@flashingcursor
flashingcursor / remove_hentry.php
Created October 8, 2012 06:28
Strip hentry from WordPress posts...
<?php
/**
* Remove the hentry class from posts in WordPress - could really remove any class using various class filters,
* like body_class using this technique.
*
* @param array $classes
* @return array
*/
add_filter( 'post_class', 'fc_remove_hentry', 20 );