Skip to content

Instantly share code, notes, and snippets.

@topleague
Last active December 3, 2019 07:11
Show Gist options
  • Save topleague/c4f8cef721930d86e0d1d995a22bc33a to your computer and use it in GitHub Desktop.
Save topleague/c4f8cef721930d86e0d1d995a22bc33a to your computer and use it in GitHub Desktop.
Display Genesis Blog in Grid Layout
//* Grid Style Content Archive
function be_archive_post_class( $classes ) {
// Don't run on single posts or pages
if( !is_home() )
return $classes;
$classes[] = 'one-half';
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 )
$classes[] = 'first';
return $classes;
}
add_filter( 'post_class', 'be_archive_post_class' );
function he_archive_post_class( $classes ) {
// Don't run on single posts or pages
if( !is_category() )
return $classes;
$classes[] = 'one-half';
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 )
$classes[] = 'first';
return $classes;
}
add_filter( 'post_class', 'he_archive_post_class' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment