我正在尝试将帖子类型拉入基于骨骼的主题,我希望这些帖子能够存在于div中。例如
<div class="fourcol"></div>
问题是,一些div还需要一类“第一”或“最后”。
现在,我正在使用JQuery查找所有带有“fourcol”类的div,并将“first”类添加到行中的第一个div,将“last”类添加到行中的最后一个div行。它似乎有用,但是当页面加载时会有一些变化,并且它看起来并不像我希望的那样安全。当尝试过滤帖子类型时,它也会导致问题,因为第一个和最后一个div不断变化,并且jQuery没有重新加载以反映帖子的新位置。
有没有更好的方法将这些帖子拉入div?
我已经尝试了所有可以提出的小修正,但我确定它已经出现,所以我想我会在这里发布。如果您有任何建议,请告诉我们!
到目前为止,这是我的循环:
<?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(); ?>