Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Created February 18, 2014 17:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuadavidnelson/9075538 to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/9075538 to your computer and use it in GitHub Desktop.
Modify Post Classes on Archive Page in Genesis for columns
<?php
/**
* Adds classes to your posts for a specific page (say, a custom post type archive for instance)
*
* @author Joshua David Nelson, joshuadnelson.com
**/
// Three Columns
function jdn_code_archive_post_class( $classes ) {
$classes[] = 'one-third teaser'; // classes, these turn the format into three columns
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 ) // the first and every three after that should get the 'first' class
$classes[] = 'first';
return $classes;
}
add_filter( 'post_class', 'jdn_code_archive_post_class' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment