Created
December 17, 2012 15:51
-
-
Save billerickson/4319329 to your computer and use it in GitHub Desktop.
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 row classes to the archive pages | |
| * | |
| * @param array $classes | |
| * @return array $classes | |
| */ | |
| function be_row_classes( $classes ) { | |
| // Only run on archive pages | |
| if( is_singular() ) | |
| return $classes; | |
| global $wp_query; | |
| if( 0 == $wp_query->current_post ) | |
| $classes[] = 'row-1'; | |
| if( 1 == $wp_query->current_post ) | |
| $classes[] = 'row-2'; | |
| if( 2 == $wp_query->current_post ) | |
| $classes[] = 'row-3'; | |
| if( 3 == $wp_query->current_post ) | |
| $classes[] = 'row-4'; | |
| if( in_array( $wp_query->current_post, array( 4, 5 ) ) | |
| $classes[] = 'row-5'; | |
| if( in_array( $wp_query->current_post, array( 6, 7 ) ) | |
| $classes[] = 'row-6'; | |
| return $classes; | |
| } | |
| add_filter( 'body_class', 'be_row_classes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment