Wordpress 前\u帖子\u链接返回空值

Wordpress 前\u帖子\u链接返回空值,wordpress,Wordpress,我正在使用下面提到的代码在我的文章之间导航,但是“上一篇文章”和“下一篇文章”链接没有显示任何内容,只是在浏览器上返回空白 循环结束后,我在index.php和single.php页面上使用下面提到的代码 index.php:和single.php <div class="navi"> <div class="right"> <?php previous_posts_link('P

我正在使用下面提到的代码在我的文章之间导航,但是“上一篇文章”和“下一篇文章”链接没有显示任何内容,只是在浏览器上返回空白

循环结束后,我在index.php和single.php页面上使用下面提到的代码

index.php:和single.php

   <div class="navi">
        <div class="right">
            <?php previous_posts_link('Previous'); ?> / <?php next_posts_link('Next'); ?>
        </div>
    </div>

/ 
预期结果:

上一个/下一个

但是我越来越 结果:

/


我在这里遗漏了什么。

尝试在函数
中添加
$the\u query->max\u num\u pages
,然后根据您的查询设置
$the\u query
变量

// the loop
while ( $the_query->have_posts() ) : $the_query->the_post(); 
?>
<?php the_title(); ?>
<?php endwhile; ?>

<?php

// next_posts_link() usage with max_num_pages
next_posts_link( 'Older Entries', $the_query->max_num_pages );
previous_posts_link( 'Newer Entries' );
//循环
while($the_query->have_posts()):$the_query->the_post();
?>

尝试在函数
next\u posts\u link()
中添加
$the\u query->max\u num\u pages
,并根据您的查询设置
$the\u query
变量

// the loop
while ( $the_query->have_posts() ) : $the_query->the_post(); 
?>
<?php the_title(); ?>
<?php endwhile; ?>

<?php

// next_posts_link() usage with max_num_pages
next_posts_link( 'Older Entries', $the_query->max_num_pages );
previous_posts_link( 'Newer Entries' );
//循环
while($the_query->have_posts()):$the_query->the_post();
?>

尝试在函数
next\u posts\u link()
中添加
$the\u query->max\u num\u pages
,并根据您的查询设置
$the\u query
变量

// the loop
while ( $the_query->have_posts() ) : $the_query->the_post(); 
?>
<?php the_title(); ?>
<?php endwhile; ?>

<?php

// next_posts_link() usage with max_num_pages
next_posts_link( 'Older Entries', $the_query->max_num_pages );
previous_posts_link( 'Newer Entries' );
//循环
while($the_query->have_posts()):$the_query->the_post();
?>

尝试在函数
next\u posts\u link()
中添加
$the\u query->max\u num\u pages
,并根据您的查询设置
$the\u query
变量

// the loop
while ( $the_query->have_posts() ) : $the_query->the_post(); 
?>
<?php the_title(); ?>
<?php endwhile; ?>

<?php

// next_posts_link() usage with max_num_pages
next_posts_link( 'Older Entries', $the_query->max_num_pages );
previous_posts_link( 'Newer Entries' );
//循环
while($the_query->have_posts()):$the_query->the_post();
?>

它应该在while($the_query->have_posts()):$the_query->the_post()的循环中
;etc
否。我在这里试图实现的是页面底部的一个上一个/下一个链接。因此,它们必须存在于循环之外。我刚刚在某个地方读到,它们也在循环之外工作。但是我还是尝试了一下,代码没有显示任何东西,即使我把它放在循环中。所以,我猜这里还有其他错误,我在single.php的循环中使用它,我想在帖子之间切换。但是在index.php中,我在循环外使用它在文章页面之间切换,而不是在单个文章之间切换。它应该在循环中
while($theu query->have_posts()):$theu query->theu post();etc
否。我在这里试图实现的是页面底部的一个上一个/下一个链接。因此,它们必须存在于循环之外。我刚刚在某个地方读到,它们也在循环之外工作。但是我还是尝试了一下,代码没有显示任何东西,即使我把它放在循环中。所以,我猜这里还有其他错误,我在single.php的循环中使用它,我想在帖子之间切换。但是在index.php中,我在循环外使用它在文章页面之间切换,而不是在单个文章之间切换。它应该在循环中
while($theu query->have_posts()):$theu query->theu post();etc
否。我在这里试图实现的是页面底部的一个上一个/下一个链接。因此,它们必须存在于循环之外。我刚刚在某个地方读到,它们也在循环之外工作。但是我还是尝试了一下,代码没有显示任何东西,即使我把它放在循环中。所以,我猜这里还有其他错误,我在single.php的循环中使用它,我想在帖子之间切换。但是在index.php中,我在循环外使用它在文章页面之间切换,而不是在单个文章之间切换。它应该在循环中
while($theu query->have_posts()):$theu query->theu post();etc
否。我在这里试图实现的是页面底部的一个上一个/下一个链接。因此,它们必须存在于循环之外。我刚刚在某个地方读到,它们也在循环之外工作。但是我还是尝试了一下,代码没有显示任何东西,即使我把它放在循环中。所以,我猜这里还有其他错误,我在single.php的循环中使用它,我想在帖子之间切换。但在index.php中,我在循环外使用它在文章页面之间切换,而不是在单个文章之间切换。@Mihai此函数有两个参数。请check@Mihai此函数有两个参数。请check@Mihai此函数有两个参数。请check@Mihai此函数有两个参数。请检查