Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.