Created
June 12, 2015 18:21
-
-
Save kalenjohnson/157892a889f4c5c62ef7 to your computer and use it in GitHub Desktop.
Row Helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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