Using WP Loop with 960 grid / Bones theme - Filterable Portfolio

263 views Asked by At

I'm trying to pull post types into my Bones based theme, and I'd like those posts to live inside of divs. eg.

<div class="fourcol"></div>

The problem is, some of the divs will also need a class of "first" or "last".

Right now, I'm using JQuery to find all of the divs with the class "fourcol" and adding a "first" class to the first div in the row, and a "last" class to the last div in the row. It seems to work, but there's a little bit of shifting when the page loads, and it doesn't seem as safe as I'd like it to be. It also causes issues when trying to filter the post types, as the first and last div are constantly changing, and the jQuery isn't reloading to reflect the posts new position.

Is there better way to pull these posts into divs?

I've tried everything I can to come up with minor fixes, but I'm sure it's come up before so I figured I'd post it here. Let me know if you have any suggestions!

Here's my loop so far:

<?php query_posts( array( 'cat' => 10, 'post_type' => 'people', 'showposts'=>-1 ) ); ?>
<?php while (have_posts()) : the_post(); ?>

<div class="threecol">
<article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?> role="article">

<header class="article-header">
<center><h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3></center>
</header> <?php // end article header ?>

<section class="entry-content clearfix">
<a class="ctp-hover" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<span class="hover-caption">VIEW</span>
<?php the_post_thumbnail('full'); ?>
</a>
</section> <?php // end article section ?>

</article> <?php // end article ?>
</div>

<?php endwhile; ?>

<?php wp_reset_query(); ?>
0

There are 0 answers