我不知道到目前为止你尝试了什么,但下面你有一个快速的答案,可以根据ID列出一个类别中的帖子。
<?php
$args = array(
\'posts_per_page\' => -1, // Will show all posts from the category
\'cat\' => 149, // ID of the category
\'orderby\' => \'post_date\',
\'order\' => \'DESC\',
\'post_type\' => \'post\',
\'post_status\' => array(\'publish\')
);
$posts_list = get_posts( $args );
foreach ( $posts_list as $post ) :
setup_postdata( $post ); ?>
<article>
<li>
<?php echo get_the_date(); ?>
<?php echo get_the_title(); ?>
<?php echo get_the_excerpt(); ?>
Category: <?php echo get_the_term_list( $post->ID, \'category\', \'\', \' \' ); ?>
</li>
</article>
<?php
endforeach;
wp_reset_postdata();
?>