Skip to content

Instantly share code, notes, and snippets.

@billerickson

billerickson/functions.php

Last active Aug 29, 2015
Embed
What would you like to do?
<?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