Created
January 13, 2015 15:39
-
-
Save apisandipas/a81aaca851881f80114c to your computer and use it in GitHub Desktop.
Dynamic html rows for the Loop
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
| /** | |
| * When Looping over a collection of posts, this will configure and out put the row seperator in the correct place. | |
| * | |
| * Must be used within the Loop | |
| * | |
| * @param integer $numCols the number of columns in each row iteration | |
| * @param string $rowSeperator the html output to seperate the rows, defaults to: </div><div class='row'> | |
| * @return string | |
| */ | |
| function bp_dynamic_rows( $numCols = 2, $rowSeperator = "</div><div class='row'>" ){ | |
| global $wp_query; | |
| if ( ( $wp_query->current_post + 1 ) % $numCols == 0 ): | |
| echo $rowSeperator; | |
| endif; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment