したがって、次のような単純なループがある場合: 投稿を異なる列に出力するにはどうすればよいでしょうか? 左右の列に入る奇数/偶数の投稿のように (スタイリング目的で)。
クラスを連続する各投稿に追加するフィルターを作成できますが、その後、単一/アーカイブ ページの css でそれらを上書きする必要があります。html構造でそれを行うためのより良い方法が必要だと思います。
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('posts_per_page=3&paged=' . $paged);
?>
<?php if (have_posts()) : while ( have_posts()) : the_post(); ?>
<div <?php post_class('clearfix') ?> id="post-<?php the_ID(); ?>">
<span><?php the_time('M jS, Y') ?></span>
<?php echo '<em>Written by </em> <br>'; the_author_posts_link(); ?>
<?php the_tags('Tags: ', ', ', '<br />'); ?>
<?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments-link', ''); ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php global $more; $more = 0; ?>
<?php the_post_thumbnail(); ?>
<?php the_content('Read on...'); ?>
<?php endwhile; endif; ?>