Skip to content

Instantly share code, notes, and snippets.

@sunilw
Created September 6, 2015 23:24
Show Gist options
  • Save sunilw/57cdabd9806d8fe64a44 to your computer and use it in GitHub Desktop.
Save sunilw/57cdabd9806d8fe64a44 to your computer and use it in GitHub Desktop.
<div class="container-fluid">
<?php
$args = array(
'posts_per_page' => 9
) ;
$my_posts = get_posts($args) ;
$chunks = array_chunk( $my_posts , 3 ) ;
$total_count = count($chunks) ;
$counter = ($total_count -1) ;
echo "<h2>" . "total count: " . $total_count . "</h2>" ;
// var_dump( $chunks ) ;
$chunkIndex = 0 ;
while( $total_count != 0 ) { ?>
<div class="row clearfix">
<?php
foreach($chunks as $chunk) {
echo "<div style='margin-bottom: 38px'>" ;
var_dump($chunk) ;
echo "</div>" ;
}
?>
</div> <!-- ENDS .row -->
<?php
$chunkIndex++ ;
$total_count-- ;
} // endwhile
?> </div> <!-- ENDS .container -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment