Created
February 5, 2017 16:39
-
-
Save carasmo/d4e282f018f720d2eeb9e752b6fb1948 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 | |
//don't add | |
/* | |
* Add Genesis one-third (3 col) class to the article.post in archives | |
* in the main query. Uses Genesis specific filter | |
* instead of WordPress's post_class filter | |
* to do the same thing 'cause why not! | |
* | |
*/ | |
function themeprefix_add_column_grid_entry_archive( $attributes ) { | |
global $wp_query; | |
//is the main query and is not singular | |
if( $wp_query->is_main_query() && ! is_singular() ) { | |
$attributes['class'] .= ' one-third'; | |
if( 0 == $wp_query->current_post % 3 ) { | |
$attributes['class'] .= ' first'; | |
} | |
} | |
return $attributes; | |
} | |
add_filter( 'genesis_attr_entry', 'themeprefix_add_column_grid_entry_archive' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment