Last active
August 29, 2015 14:02
-
-
Save robneu/0a7c155c315d09d4b7d6 to your computer and use it in GitHub Desktop.
Create a simple Genesis grid loop by filtering the post class.
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_filter( 'post_class', 'prefix_simple_grid_class' ); | |
| /** | |
| * Add post classes for a simple grid loop. | |
| * | |
| * @category Grid Loop | |
| * @version 1.0.0 | |
| */ | |
| function prefix_simple_grid_class( $classes ) { | |
| global $wp_query; | |
| $current_post = $wp_query->current_post; | |
| $classes[] = 'simple-grid one-third'; | |
| if ( 0 === $current_post || 0 === $current_post % 3 ) { | |
| $classes[] = 'first'; | |
| } | |
| return $classes; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment