我的自定义主页模板中未显示分页。这是我的页面代码:
<?php
/**
* Template Name: Homepage Template
* The main template file.
*
*/
get_header(); ?>
<div id="primary" class="content-area container">
<div id="main" class="site-main col-lg-9 col-md-9 col-sm-12 col-xs-12" role="main">
<?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; ?>
<?php
$args = array(
'post_type' => 'article',
'paged' => $paged
);
$articles = new WP_Query($args);
if ( $articles->have_posts() ) :
/* Start the Loop */
while ( $articles->have_posts() ) : $articles->the_post();
get_template_part( 'template-parts/content-article', get_post_format() );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content-article', 'none' );
endif; ?>
</div><!-- #main -->
<?php get_sidebar(); ?>
</div><!-- #primary -->
<?php get_footer(); ?>
有人知道如何让分页工作吗?