Created
February 18, 2014 17:27
-
-
Save joshuadavidnelson/9075538 to your computer and use it in GitHub Desktop.
Modify Post Classes on Archive Page in Genesis for columns
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 | |
/** | |
* Adds classes to your posts for a specific page (say, a custom post type archive for instance) | |
* | |
* @author Joshua David Nelson, joshuadnelson.com | |
**/ | |
// Three Columns | |
function jdn_code_archive_post_class( $classes ) { | |
$classes[] = 'one-third teaser'; // classes, these turn the format into three columns | |
global $wp_query; | |
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 ) // the first and every three after that should get the 'first' class | |
$classes[] = 'first'; | |
return $classes; | |
} | |
add_filter( 'post_class', 'jdn_code_archive_post_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment