Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/3b7b98b17a441e8efc72 to your computer and use it in GitHub Desktop.
Save billerickson/3b7b98b17a441e8efc72 to your computer and use it in GitHub Desktop.
<?php
/**
* Column Classes
*
* @param int $columns, how many columns content should be broken into
* @param int $count, the current post in the loop (starts at 0)
* @param int $extra_classes, any additional classes to add on all posts
* @return string $classes
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/get-column-classes/
*/
function be_column_classes( $columns = 2, $count = 0, $extra_classes = '' ) {
$column_classes = array( '', '', 'one-half', 'one-third', 'one-fourth', 'one-fifth', 'one-sixth' );
$output = $column_classes[$columns];
if( 0 == $count || 0 == $count % $columns )
$output .= ' first';
if( $extra_classes )
$output .= ' ' . $extra_classes;
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment