创建page template 并使用wp\\u query以要显示的类别为目标
$args = array(\'category_name\' => \'your category name\',);
WP_Query 将帮助您选择返回哪些帖子并通过循环显示这些帖子。
下面是一个页面模板示例(这基于\\u的主题)
<?php
/**
* Template Name: Your template name
*
* @package _s
*/
get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<header class="entry-header">
<?php the_title( \'<h1 class="entry-title">\', \'</h1>\' ); ?>
<div class="entry-meta">
</div><!-- .entry-meta -->
</header><!-- .page-header -->
<?php
$args = array(
\'category_name\' => \'your category name\',
);
?>
<?php
$the_query = new WP_Query($args);
while($the_query->have_posts()) : $the_query->the_post();
?>
<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( \'content\', get_post_format() );
?>
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( \'content\', \'none\' ); ?>
<?php endif; ?>
</main><!-- #main -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
您还可以
generate your wp_query 让事情变得简单一点。