Last active
December 10, 2015 18:59
-
-
Save whyisjake/4478704 to your computer and use it in GitHub Desktop.
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
$args = array( | |
'category__in' => $cat_ID, | |
'posts_per_page' => 8, | |
'no_found_rows' => true, | |
); | |
$the_query = new WP_Query( $args ); | |
//Maybe array_chunk isn't the right thing to do here... | |
$arrays = array_chunk( $the_query->posts, 4, true ); | |
foreach( $arrays as $posts) { | |
//print_r($posts); | |
//Since there are two seperate arrays, this returns true for both of them... | |
if ($posts[0]) { | |
echo '<div class="item active">'; | |
} else { | |
echo '<div class="item">'; | |
} | |
echo '<div class="row">'; | |
foreach ($posts as $post) { | |
echo '<div class="span3">'; | |
echo get_the_post_thumbnail( $post->ID ); | |
echo get_the_title( $post->ID ); | |
echo '</div>'; | |
} | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment