Created
March 31, 2015 17:56
-
-
Save webmasterninjay/e29b755e5ea568e67f5d 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_filter('post_class', 'jay_grid_view_post_class'); | |
function jay_grid_view_post_class( $classes ) { | |
if( is_post_type_archive( $posttype ) ): | |
$columns = 3; | |
$classes[] = 'one-third'; | |
global $wp_query; | |
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % $columns ) | |
$classes[] = 'first'; | |
endif; | |
return $classes; | |
} | |
add_action('pre_get_posts', 'jay_post_items'); | |
function jay_post_items( $query ) { | |
if( $query->is_main_query() && !is_admin() && is_archive() ) { | |
$query->set( 'posts_per_page', '9' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment