I am using WP_query for my custom post type archive page, and the query seems to be stuck in the infinite loop.
archive.php
<?php
$query = new WP_Query(array(
'post_type' => 'faqs',
'post_status' => 'publish',
'posts_per_page' => -1
));
while ($query->have_posts()) {
$query->the_post();
$faqs_loop = get_template_part('loop-faqs');
}
wp_reset_query();
?>
loop.php
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<div class="accordion-section">
<a class="accordion-section-title" href="#<?php the_id(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<div id="<?php the_id(); ?>" class="accordion-section-content">
<?php the_content(); ?>
</div>
</div>
<?php endwhile; ?>
你不能在webb中做一个无限循环,它只会加载到浏览器崩溃或停止处理
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.