Skip to content

Instantly share code, notes, and snippets.

@keirwhitaker
keirwhitaker / wordpress=body-tag-css.css
Created December 7, 2011 09:33
Customising the Body Tag
/* Nav hover styles */
header nav .primary li a:hover,
#latest header nav .primary li a.latest,
#design header nav .primary li a.design,
#development header nav .primary li a.development,
#mobile header nav .primary li a.mobile,
#tags header nav .primary li a.tags { background: #E9E7DC url(/img/light_background_tile.jpg); color: #545351; text-shadow: none; }
@keirwhitaker
keirwhitaker / add_slug_to_body_class.php
Created May 21, 2012 10:01
WordPress Page Template Snag Lists
<?php
// Add the filter and function to your functions.php file
add_filter('body_class', 'add_slug_to_body_class');
function add_slug_to_body_class($classes) {
global $post;
if(is_page()) {
$classes[] = sanitize_html_class($post->post_name);
} elseif(is_singular()) {
@keirwhitaker
keirwhitaker / page-category.php
Created August 18, 2012 06:51
Category Page
<?php
/**
* Template Name: Category Page
*/
get_template_part('parts/shared/html-header');
get_template_part('parts/shared/header');
$args = array(
'type' => 'post',
'child_of' => 0,
@keirwhitaker
keirwhitaker / permalinks-all
Last active December 27, 2015 11:29
Lists all products and variants along with a cart permalink that will add one of that variant to the cart
@keirwhitaker
keirwhitaker / photo-cpt.php
Created September 17, 2014 20:24
A custom post type for photos
<?php
add_action( 'init', 'register_cpt_photo' );
function register_cpt_photo() {
$labels = array(
'name' => _x( 'Photos', 'photo' ),
'singular_name' => _x( 'Photo', 'photo' ),
'add_new' => _x( 'Add New', 'photo' ),
/**
* Shortcode that outputs a figure in the WordPress content editor generated content
* @author Keir Whitaker ([email protected] | keirwhitaker.com)
*
* @param type $atts The src attribute
* @param type $content The caption for the figcaption
* @return string
*
* Usage [figure src="/wp-content/test.jpg"]This is not linked up but this is <a href="http://yahoo.com">This is the content</a>[/figure]
*
@keirwhitaker
keirwhitaker / 0_reuse_code.js
Last active September 3, 2015 19:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@keirwhitaker
keirwhitaker / footer.liquid
Last active July 10, 2017 12:07
A static section which allows a Shopify store owner to enter a title and description for a promotion
@keirwhitaker
keirwhitaker / footer-extract-1.liquid
Created July 11, 2017 09:22
Extract of footer.liquid #1
@keirwhitaker
keirwhitaker / footer-extract-2.liquid
Created July 11, 2017 09:24
Extract of footer.liquid #2