Skip to content

Instantly share code, notes, and snippets.

@kalenjohnson
Created June 12, 2015 18:21
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 kalenjohnson/157892a889f4c5c62ef7 to your computer and use it in GitHub Desktop.
Save kalenjohnson/157892a889f4c5c62ef7 to your computer and use it in GitHub Desktop.
Row Helper
<?php
/**
* Keep track of the amount of items in a row, and add another .row when necessary
*
* @param int $i
* @param int $item_count
* @param string $class_name
*
* @return bool|string
*/
function row_helper($i, $item_count, $class_name = 'row') {
// $item_count should equal the amount of items you want in each row
if ($i !== 0 && ($i % $item_count) === 0) {
return "</div><div class='{$class_name}'>";
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment