我正在使用这样的多个循环
<?php
$posts = get_posts(\'numberposts=1&order=DESC&orderby=post_date&category=\'.get_cat_ID( \'سیاست\' ));
foreach ($posts as $post) : start_wp(); ?>
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
<div class="content">
<h2><a href="<?php the_permalink()?>"><?php the_title()?></a></h2>
<p><?php the_excerpt(); ?></p>
<hr/>
<?php
endforeach;
?>
在我的大部分主题中,如侧边栏、页脚、不同类别的幻灯片,我所面临的问题是,当我在存档中使用以下循环时。php或类别。php根据类别显示帖子数据(如标题、摘录和功能图片),但它没有显示任何内容。当我删除所有上述循环时,它就工作了。这是我的存档或类别中的循环。php显示文章摘录和标题:<?php if(have_posts()):?>
<?php while ( have_posts() ) : the_post(); ?>
<?Php the_title(); ?><br/>
<?php endwhile; ?>
<?php endif;?>
我记得有一次我遇到了这个问题,通过使用wp_reset_query
每次循环后,但现在不起作用。大概wp_reset_query
不适用于foreach循环。