我正在尝试在显示自定义循环的主题页上交替背景:
$args = array( \'post-type\' => \'portfolio\', \'posts_per_page\' => 10 );
$loop = new WP_Query( $args );
$count = 0;
while ($loop->have_posts() ) : $loop->the_post();
<div class="wrapper <?php if(++$count%2==0) echo \'grey-box\'; else echo \'white-box\'; ?>">
<div class="portfolio-picture <?php if(++$count%2==0) echo \'portfolio-grey-box\'; else echo \'portfolio-white-box\'; ?>">
<?php $videocode = get_post_meta($post->ID, \'video-embed-code\', true); //is the custom field being used?
if ($videos) {
echo $videocode;
}
else
if ( has_post_thumbnail() ) {
the_post_thumbnail(\'portfolio-picture\');
};
?>
</div>
<div class="portfolio-description">
<p><strong><?php the_title(); ?></strong></p>
<p><?php the_content(); ?></p>
</div>
<div class="clear"></div>
</div>
<?php endwhile; ?>
但风格似乎没有改变。我错过什么了吗?