更新时间:2023-01-30 12:33:12
我会开始一个新的循环,使用循环函数(the_content(),the_title()等)获得发布数据。
I would start a new loop, as it's much easier to get post data using the functions made for the Loop ( the_content(), the_title(), etc.)
试试这个作为一个起点:
Try this as a staring point:
<?php
$new_loop = new WP_Query( array(
'post_type' => 'post',
'orderby' => 'category'
) );
?>
<?php if ( $new_loop->have_posts() ) : while ( $new_loop->have_posts() ) : $new_loop->the_post(); ?>
<section>
<a href='javascript:history.back();'>←Tilbake</a>
<header style='font-size: 30px;'>
<h2><?php the_title();?></h2>
</header>
<p><?php the_content();?></p>
</section>
<?php endwhile; else: ?>
<?php endif; ?>
<?php wp_reset_query(); ?>