<?php if (have_posts()) : ?>
<?php
$count = 1;
$featuredPosts = 9;
query_posts('showposts=19');
?>
<div class="articleTile column_3">
<?php while (have_posts()) : the_post(); ?>
<?php if($count > $featuredPosts) : ?>
<!--change class to articleList column_2-->
<?php endif; ?>
<div class="column">
<?php get_template_part('content', 'featured'); ?>
<!-- #post-<?php the_ID(); ?> -->
</div>
<?php
$count = $count ++;
endwhile;
?>
</div>
我怎么会去瞄准<div class="articleTile column_3">
元素,当计数变量达到10改变其类的内部元素的CSS类?更改驻留在循环外从环
编辑:我是一个白痴抱歉。
我已经成功做到这一点的:
<?php if (have_posts()) : ?>
<?php
$count = 1;
$featuredPosts = 9;
query_posts('showposts=19');
?>
<div class="articleTile column_3">
<?php while (have_posts()) : the_post(); ?>
<?php if($count == $featuredPosts + 1) : ?>
<?php echo $count ?>
</div>
<div class="articleList column_2">
<?php endif; ?>
<div class="column">
<?php echo $count ?>
<?php get_template_part('content', 'featured'); ?>
<!-- #post-<?php the_ID(); ?> -->
</div>
<?php
$count = $count +1;
endwhile;
?>
</div>
我原来的方式根本就不需要工作没有与不同类别的第二个元素。我很抱歉。感谢他们的快速反应,他们帮助我指出了正确的方向。
你将不得不赶在变量中环的输出,并呼应容器事后含量 – DaveRandom 2012-04-26 09:15:38