分页在main index.php中不起作用

分页在main index.php中不起作用,php,wordpress,pagination,Php,Wordpress,Pagination,因此,我显示旧文章的链接没有显示在我的主博客页面上,它在我的archive.php中显示得很好,所以我不确定它为什么不能与index.php一起使用。我正在使用下划线作为我的基本主题。这是我的代码: <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php /* Inclu

因此,我显示旧文章的链接没有显示在我的主博客页面上,它在我的archive.php中显示得很好,所以我不确定它为什么不能与index.php一起使用。我正在使用下划线作为我的基本主题。这是我的代码:

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : 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 _s_paging_nav(); ?>

    <?php else : ?>

        <?php get_template_part( 'content', 'none' ); ?>


    <?php endif; ?>

我通常在循环外运行分页导航,并测试是否会显示上一个或下一个链接:

<?php if (  $wp_query->max_num_pages > 1 ) : ?>
    <?php if($wp_query->get('paged') || $wp_query->get('paged') > 1): ?>
        <a class="loadPrev" href="<?php previous_posts(); ?>">prev</a>
    <?php endif; ?>

    <?php if ($next_url = next_posts($wp_query->max_num_pages, false)): ?>
        <a class="loadNext" href="<?php echo $next_url; ?>">next</a>
    <?php endif;?>
<?php endif; ?>