Php 找不到第2页(404)Wordpress分页

Php 找不到第2页(404)Wordpress分页,php,wordpress,pagination,Php,Wordpress,Pagination,我在localhost中测试WordPress,发布文章以查看其工作情况,一切正常,直到我不得不在一个页面中添加很多文章,并且必须使用分页转到第二个页面,我单击了第二个页面,但我得到了一个404未找到页面 我找了大约2-3个小时,尝试了每个函数,每个示例,但结果都是一样的 主页是一个静态首页,称为登陆,所有文章都设置为博客页面 index.php中的我的php代码: <div class="container-medium"> <div class="row">

我在localhost中测试WordPress,发布文章以查看其工作情况,一切正常,直到我不得不在一个页面中添加很多文章,并且必须使用分页转到第二个页面,我单击了第二个页面,但我得到了一个404未找到页面

我找了大约2-3个小时,尝试了每个函数,每个示例,但结果都是一样的

主页是一个静态首页,称为登陆,所有文章都设置为博客页面

index.php中的我的php代码:

<div class="container-medium">
    <div class="row">


        <?php while(have_posts()) : the_post(); ?>
        <div class="col-xs-12 col-sm-12 col-md-12">
            <?php the_post_thumbnail('post-thumbnail', array( 'class'   => "img-responsive desaturate attachment-post-thumbnail")); ?> 
            <h3 class="blog-post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
            <div class="row">
                <div class="col-sm-12"><p class="blog-post-text"><?php echo get_excerpt(); ?></p></div>
                <div class="col-sm-12"><a class="btn btn-sm btn-readmore" href="<?php echo get_permalink(); ?>">Read more <i class="icon-right-open"></i></a></div>
            </div>
        <hr class="dotted">
    </div>


    <?php endwhile; wp_reset_query(); ?>
    </div> <!-- end .row -->
            <?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; ?>

</div> <!-- end .container-medium -->


我读了很多类似的问题,但我没有得到我想要的结果

谢谢大家!


PS:PHP初学者

在循环时写下以上内容

<?php


    $post_query = query_posts(array(
    'post_type'      => 'cover', // You can add a custom post type if you like
    'paged'          => get_query_var('paged', 1),
    'posts_per_page' => 1
));

?>

在底部

  <?php

  global $wp_query;

  $big = 999999999; // need an unlikely integer

  echo paginate_links( array(
       'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
       'format' => '?paged=%#%',
       'current' => max( 1, get_query_var('paged') ),
       'total' => $wp_query->max_num_pages
   ) );

  ?>


我试图更改永久链接,并且正在使用默认结构(website.com/?p=123)。我试试看。感谢您没有工作,只是显示分页,但是帖子已经消失。在您的本地主机中,重写模式是关闭的,这就是为什么只有permalink的默认结构工作…将该重写模式更改为打开