我制作了一个页面模板,但当我单击分页时,它不起作用。
<?php
/**
* Template Name: ashole
*
* @link https://codex.wordpress.org/Template_Hierarchy
* @package Dan
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php query_posts("showposts=2") ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><br />
<?php echo get_the_category_list(\', \'); ?>
<?php the_time(\'d/m/Y g:i:s A\'); ?><br />
<img src="<?php $img=wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), \'large\'); echo $img[0]; ?>"/><br />
<?php the_excerpt(); ?> <br />
<?php endwhile;
/* Previous/next page navigation. */
the_posts_pagination( array(
\'prev_text\' => \'<span class="fas fa-angle-double-left" aria-hidden="true"></span> \' . __( \'Previous page\', \'dan\' ),
\'next_text\' => __( \'Next page\', \'dan\' ) . \' <span class="fas fa-angle-double-right" aria-hidden="true"></span>\',
\'before_page_number\' => \'<span class="meta-nav screen-reader-text">\' . __( \'Page\', \'dan\' ) . \'</span>\',
) );
?>
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();