Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created September 10, 2012 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/3692697 to your computer and use it in GitHub Desktop.
Save billerickson/3692697 to your computer and use it in GitHub Desktop.
Grid loop for taxonomy archives
<?php
/**
* Set up the Grid Loop
* @author Bill Erickson
* @link http://www.billerickson.net/genesis-grid-loop-content/
*
*/
function child_grid_loop_helper() {
$args = array(
'features' => 2,
'feature_image_size' => 'child_full',
'feature_image_class' => 'aligncenter post-image',
'feature_content_limit' => 0,
'grid_image_size' => 0,
'grid_content_limit' => 0,
'more' => __( '[Continue reading...]', 'genesis' ),
'posts_per_page' => 10,
);
if( is_category() )
$args['cat'] = get_query_var( 'cat' );
elseif( is_tag() )
$args['tag'] = get_query_var( 'tag' );
elseif( is_tax() )
$args['tax_query'] = array(
array(
'taxonomy' => get_query_var( 'taxonomy' ),
'field' => 'slug',
'terms' => get_query_var( get_query_var( 'taxonomy' ) ),
)
);
if( is_category() || is_tag() || is_tax() )
genesis_grid_loop( $args );
else
genesis_standard_loop();
}
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper' );
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment