如果您交换下面的代码,此代码应该可以帮助您实现您想要的
<?php wp_link_pages( array( \'before\' => \'<div class="page-link-next-prev">\',
\'after\' => \'</div>\', \'next_or_number\' => \'next\', \'previouspagelink\' =>
__(\'Previous\'), \'nextpagelink\'=> __(\'Next\') ) );?>
使用此代码
<?php
global $page, $pages;
// This shows the Previous link
wp_link_pages( array( \'before\' => \'<div class="page-link-next-prev">\',
\'after\' => \'\', \'previouspagelink\' => \'Previous\', \'nextpagelink\' => \'\',
\'next_or_number\' => \'next\' ) );
// This shows the page count i.e. "1 of 5"
echo( $page.\' of \'.count($pages) );
// This shows the Next link
wp_link_pages( array( \'before\' => \'\', \'after\' => \'</div>\', \'previouspagelink\' => \'\',
\'nextpagelink\' => \'Next\', \'next_or_number\' => \'next\' ) );
?>
这将显示下一个和上一个链接,页面计数介于两者之间。
要让“下一步”按钮点击进入下一篇文章,您可以使用以下内容进一步扩展代码:
<?php
// If the current page equals the last page
if ($page == count($pages)):
// Prepare the next post
// See: https://codex.wordpress.org/Function_Reference/get_next_post
$next_post = get_next_post();
// Then spit out the next link
?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>">Next</a>
<?php
// End the if statement
endif; ?>