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 9, 2012 08:49
Genesis Grid Loop - Part 1
<?php
add_action( 'genesis_before_loop', 'child_maybe_do_grid_loop' );
/**
* Possibly amend the loop.
*
* Before we get to the loop, see if we're anywhere but a single page. If so,
* swap out the standard loop for our grid loop.
*
* @author Gary Jones
@GaryJones
GaryJones / functions.php
Created February 9, 2012 08:54
Genesis Grid Loop - Part 2
<?php
/**
* Prepare the grid loop.
*
* Takes care of existing query arguments for the page e.g. if it's a category
* archive page, then the "cat" argument is carried into the grid loop, unless
* it's overwritten in the $grid_args.
*
* @author Gary Jones
@GaryJones
GaryJones / functions-amended.php
Created February 9, 2012 08:57
Genesis Grid Loop - Amendment to show grid loop on first page only.
<?php
// Only use the grid on the first page
if ( 0 == $paged) {
// Merge the standard query for this page, and our preferred loop arguments
genesis_grid_loop( array_merge( $query_args, $grid_args ) );
} else {
query_posts( array_merge( $query_args, $grid_args ) );
genesis_standard_loop();
}
@GaryJones
GaryJones / functions.php
Created February 9, 2012 09:01
Genesis Grid Loop - Part 3
<?php
/**
* Add some extra body classes to grid posts.
*
* Change the $columns value to alter how many columns wide the grid uses.
*
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*
@GaryJones
GaryJones / style.css
Created February 9, 2012 09:02
Genesis Grid Loop - Styles
#content .genesis-grid {
float: left;
margin: 0;
padding: 15px 0 10px 3%;
}
#content .genesis-grid-column-1 {
clear: left;
padding-left: 0;
}
.size1of2 {
@GaryJones
GaryJones / functions.php
Created February 9, 2012 09:06
Genesis Grid Loop - Parts 1-3
<?php
add_action( 'genesis_before_loop', 'child_maybe_do_grid_loop' );
/**
* Possibly amend the loop.
*
* Before we get to the loop, see if we're anywhere but a single page. If so,
* swap out the standard loop for our grid loop.
*
* @author Gary Jones
@GaryJones
GaryJones / functions.php
Created February 10, 2012 09:16
Add the year to the post date shortcode in Vintage theme.
<?php
add_filter( 'genesis_post_date_shortcode', 'custom_post_date_shortcode', 10, 2 );
/**
* Customize post date shortcode, to include year.
*
* @param string $output Existing post date shortcode output.
* @param array $atts Associative array of shortcode attributes.
*
* @return string Amended markup.
@GaryJones
GaryJones / functions.php
Created February 10, 2012 12:03 — forked from billerickson/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
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
@GaryJones
GaryJones / functions.php
Created February 11, 2012 12:20 — forked from billerickson/widget nav.php
Add widget area before primary menu items in Genesis.
<?php
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
/**
* Adds a widget area before primary menu items.
*
* @author Bill Erickson
* @author Gary Jones
* @link https://gist.github.com/gists/1799174
@GaryJones
GaryJones / gist:1802903
Created February 11, 2012 17:35
SVN command to make a WordPress plugin tag
# Here we're copying the trunk of one of my plugins, to a tag of 1.3.0, with a simple message.
svn copy https://plugins.svn.wordpress.org/genesis-admin-bar-plus/trunk https://plugins.svn.wordpress.org/genesis-admin-bar-plus/tags/1.3.0 -m "Release 1.3.0"