新WordPress模板的分页问题


pagination issue with new wordpress template

网站博客在这里

尽管地址栏中显示了相应的第 2 页 URL,但按下第 2 页时,博客页面底部的分页不会将内容更改为第 2 页帖子 - 此外,当地址栏显示第 2 页时,第 2 页按钮不会显示为选中状态 -

我以前在这个网站上使用过这个主题分页问题在安装时也存在,但由现在无法联系的创建者排序 -

似乎这个主题的每个全新安装都有分页问题,直到编辑某些内容 -

补充一点,我不确定要发布哪些代码片段,所以如果这会有所帮助,请让我知道哪些文件,但如果这是正确的代码,这里是模板博客中的片段.php

<?php
if(is_category() || is_archive()){
    /*get page with blog template set*/
    $post_template_page_array = get_pages(array(
        'post_type' => 'page',
        'post_status' => 'publish',
        'number' => 1,
        'meta_key' => '_wp_page_template',
        'meta_value' => 'template-blog.php',
        'sort_order' => 'ASC',
        'sort_column' => 'menu_order',
    ));
    $post_template_page = $post_template_page_array[0];
    echo wpb_js_remove_wpautop(apply_filters('the_content', $post_template_page->post_content));
    global $post;
    $post = $post_template_page;
    setup_postdata($post);
} else {
    if(have_posts()) : while (have_posts()) : the_post();
        the_content();
    endwhile; endif;
}
?>

提前非常感谢任何可以为此:)提出解决方案的人

wordpress中的分页:

分页代码示例:

<?php if ( have_posts() ) : ?>
<!-- Add the pagination functions here. -->
<!-- Start of the main loop. -->
<?php while ( have_posts() ) : the_post();  ?>
 <!-- the rest of your theme's main loop -->
 <?php endwhile; ?>
 <!-- End of the main loop -->
 <!-- Add the pagination functions here. -->
  <div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
 <div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>
<?php else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

更多参考: 网址