Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save robneu/0a7c155c315d09d4b7d6 to your computer and use it in GitHub Desktop.

Select an option

Save robneu/0a7c155c315d09d4b7d6 to your computer and use it in GitHub Desktop.
Create a simple Genesis grid loop by filtering the post class.
<?php
add_filter( 'post_class', 'prefix_simple_grid_class' );
/**
* Add post classes for a simple grid loop.
*
* @category Grid Loop
* @version 1.0.0
*/
function prefix_simple_grid_class( $classes ) {
global $wp_query;
$current_post = $wp_query->current_post;
$classes[] = 'simple-grid one-third';
if ( 0 === $current_post || 0 === $current_post % 3 ) {
$classes[] = 'first';
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment