Skip to content

Instantly share code, notes, and snippets.

View peterwilsoncc's full-sized avatar

Peter Wilson peterwilsoncc

View GitHub Profile
@peterwilsoncc
peterwilsoncc / livereload.php
Created March 22, 2012 02:31
Live reload WordPress extension
<?php
/*
Plugin Name: LiveReload
Description: Adds the JavaScript for LiveReload to a WordPress site
Version: 0.0.0.0.1alpha
Author: Peter Wilson
Author URI: http://peterwilson.cc/
*/
@peterwilsoncc
peterwilsoncc / grid.css
Created April 3, 2012 01:56
Grid - @stubbornella's with an equal height addition
.g-row,.g-last{overflow:hidden; *overflow:visible;*zoom:1;}
.g{float:left;}
.g-right{float:right;}
.g-1_1{float:none;}
.g-1_2,.g-2_4,.g-3_6{width:50%;}
.g-1_3,.g-2_6{width:33.33333%;}
.g-2_3,.g-4_6{width:66.66666%;}
.g-1_4{width:25%;}
.g-3_4{width:75%;}
.g-1_5{width:20%;}
@peterwilsoncc
peterwilsoncc / functions.php
Created April 13, 2012 06:46
Soo many WordPress body & post classes.
<?php
function filter_body_class($classes, $custom_classes ){
//avoid putting in too many
unset($classes);
$classes = array();
@peterwilsoncc
peterwilsoncc / functions.php
Created July 27, 2012 04:51
Kill them useless menu classes
<?php
function pwcc_filter_nav_menu_css_class($classes, $item, $args) {
unset($classes);
$classes = array();
if (trim($item->classes[0]) != '') {
$classes[] = $item->classes[0];
}
@peterwilsoncc
peterwilsoncc / responsive-media-basic.css
Created August 8, 2012 02:06
Responsive abstractions
.media,
.med3 {
display:block;
}
.media-img,
.med3-img{
float:left;
margin-right:1em;
}
@peterwilsoncc
peterwilsoncc / ie8safehack.css
Created August 30, 2012 04:13
IE8 and below safe hack
/*
* Result should be modern browsers get a blue background
* Old browsers (incl IE8 and below) get a red background
* ref: http://caniuse.com/#feat=css-mediaqueries
*/
html {
background: red;
}
.g-row {
max-width:1200px;
*width: 960px;
overflow: hidden;
}
.g {
float: left;
padding-left: 10px;
padding-right: 10px;
@peterwilsoncc
peterwilsoncc / confused.php
Created October 31, 2012 04:10
filter_pre_get_posts help
function filter_pre_get_posts(&$query) {
if ( $query->is_home AND $query->is_main_query() ) {
$query->set('meta_key', 'my_key');
$query->set('orderby', 'meta_value_num date');
// should sort by meta-value as number, then by date
// actually sorts by date and ignores anything with my_key set
@peterwilsoncc
peterwilsoncc / social-icons-menu.css
Created January 24, 2013 21:51
Social Sharing Menu
/* Social Sharing Menu
------------------------------------------------------------ */
/*This and the next selector overrides the usual header/footer widget CSS padding etc on the links just for the social icons widget*/
/* PW note: I left these alone (except for the child combinator) because I gather they're Genesis related. */
#header #menu-social-menu a {
margin: 5px;
border: none;
padding: 0px;
}
@peterwilsoncc
peterwilsoncc / html.html
Created February 6, 2013 22:19
Retina images
<noscript>
<img src="image.png" alt="" width="96" height="96" />
</noscript>
<span class="js-retina-image" data-lowres='image.png' data-highres='image@2x.png' data-width="96" data-height="96">