我试图在分类页面上显示一组来自单个分类的帖子,使用多个循环。
<div id="featured-content" class="clearfix">
<?
// assign the variable as current category
$categoryvariable = $cat;
echo($cat);
?>
<?php query_posts(\'$cat\'); ?>
<?php $posts = get_posts(\'numberposts=1&offset=0&category=$cat\'); foreach ($posts as $post) : start_wp(); ?>
<?php static $count1 = 0; if ($count1 == "1") { break; } else { ?>
<article class="d-all d-pad">
<ul class="meta">
<li class="date"><?php echo get_the_date(\'d.m.Y\'); ?></li>
<li class="region"><?php the_terms( $post->ID, \'regions\' , \' \' ); ?></li>
<li class="cat"><?php the_category(\', \') ?></li>
</ul>
<?php if(has_post_thumbnail()) :?>
<figure class="img clearfix">
<?php the_post_thumbnail( \'featured-image\', array( \'class\' => \'featured-image\' ) ); ?>
</figure>
<?php else :?>
<?php endif;?>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<?php the_excerpt();?>
</article>
<?php $count1++; } ?>
<?php endforeach; ?>
我做错了什么,因为它没有为我所在的分类页面显示文章。