Php Wordpress链接分页仅显示下一个和上一个按钮
我有点不知道该怎么做。我有一个帖子,我想显示一个图像列表。但是,我希望用户能够单击“下一步”和“上一步”,这样他们就可以像在不同页面上一样循环浏览图像 我添加了这段代码,将帖子拆分为多个页面:Php Wordpress链接分页仅显示下一个和上一个按钮,php,html,css,wordpress,Php,Html,Css,Wordpress,我有点不知道该怎么做。我有一个帖子,我想显示一个图像列表。但是,我希望用户能够单击“下一步”和“上一步”,这样他们就可以像在不同页面上一样循环浏览图像 我添加了这段代码,将帖子拆分为多个页面: <!--nextpage--> 当前,当我添加此项时,它会显示1 2 3 Next等。。。然后,当您单击下一步或其中一个数字时,它将变为Previous 23等。。有没有办法修改它,使它只显示下一个和上一个,而不显示中间的数字 我试图修改singlepost.php的这段代码,但
<!--nextpage-->
当前,当我添加此项时,它会显示1 2 3 Next等。。。然后,当您单击下一步或其中一个数字时,它将变为Previous 23等。。有没有办法修改它,使它只显示下一个和上一个,而不显示中间的数字
我试图修改singlepost.php的这段代码,但每次修改都会导致代码被破坏:
<?php wp_link_pages(array('before' => '<div class="pagination">', 'after' => '</div>', 'link_before' => '<span class="current"><span class="currenttext">', 'link_after' => '</span></span>', 'next_or_number' => 'next_and_number', 'nextpagelink' => __('Next','mythemeshop'), 'previouspagelink' => __('Previous','mythemeshop'), 'pagelink' => '%','echo' => 1 )); ?>
嗨,我想你要找的是这个
<?php
global $page, $pages;
// If the current page equals the last page
if ($page == count($page)):
$previous_post = get_previous_post();
// Then spit out the next link
?>
<a href="<?php echo get_permalink( $previous_post->ID ); ?>"><span style="float:left;" class="meta-item">Previous Gallery</span></a>
<?php
// End the if statement
endif;
wp_link_pages( array( 'before' => '<div style="text-align: center;" class="page-link-next-prev">',
'after' => '', 'previouspagelink' => '<span style="float:left;" class="meta-item">Previous post</span>', 'nextpagelink' => '',
'next_or_number' => 'next' ) );
echo('<span style="text-align: center;">'.$page.' of '.count($pages).'</span>');
wp_link_pages( array( 'before' => '', 'after' => '</div>', 'previouspagelink' => '',
'nextpagelink' => '<span style="float:right;" class="meta-item">Next post</span>', 'next_or_number' => 'next' ) );
?>
<?php
// If the current page is first page
if ($page == count($pages)):
$next_post = get_next_post();
// Then spit out the next link
?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>"><span style="float:right;" class="meta-item">Next Gallery</span></a>
<?php
// End the if statement
endif; ?>