<?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