Created
September 10, 2012 18:19
-
-
Save billerickson/3692697 to your computer and use it in GitHub Desktop.
Grid loop for taxonomy archives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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