Created
February 9, 2012 08:49
-
-
Save GaryJones/1778554 to your computer and use it in GitHub Desktop.
Genesis Grid Loop - Part 1
This file contains hidden or 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 | |
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 | |
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/ | |
*/ | |
function child_maybe_do_grid_loop() { | |
// Amend this conditional to pick where this grid looping occurs | |
if ( ! is_single() && ! is_page() ) { | |
// Remove the standard loop | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
// Use the prepared grid loop | |
add_action( 'genesis_loop', 'child_do_grid_loop' ); | |
// Add some extra post classes to the grid loop so we can style the columns | |
add_filter( 'genesis_grid_loop_post_class', 'child_grid_loop_post_class' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment