Created
May 18, 2018 14:51
-
-
Save topleague/8168f1c3d84771b4a9d53d1e16de419e to your computer and use it in GitHub Desktop.
Grid Style Search Results
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
//* Grid Style Search Results | |
function search_results_post_class( $classes ) { | |
// Don't run on single posts or pages | |
if( !is_search() ) | |
return $classes; | |
$classes[] = 'one-third'; | |
global $wp_query; | |
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 ) | |
$classes[] = 'first'; | |
return $classes; | |
} | |
add_filter( 'post_class', 'search_results_post_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment