我正在使用wordpress。我想将文章分成几部分, 所以我使用分页符选项。但是它显示了页面分页!我只想显示Prev和Nex按钮。这就是所谓的功能代码
function mts_wp_link_pages_args( $args ) {
global $page, $numpages, $more, $pagenow;
if ( !$args['next_or_number'] == 'next_and_number' )
return $args;
$args['next_or_number'] = 'number';
if ( !$more )
return $args;
if( $page-1 )
$args['before'] .= _wp_link_page( $page-1 )
. $args['link_before']. $args['previouspagelink'] . $args['link_after'] . '</a>'
;
if ( $page<$numpages )
$args['after'] = _wp_link_page( $page+1 )
. $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . '</a>'
. $args['after']
;
return $args;
}
add_filter( 'wp_link_pages_args', 'mts_wp_link_pages_args' );
这种功能的称呼是这样的:
<?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 )); ?>
#1
你可以使用next_posts_link和previous_posts_link, 它们不输出页码, 仅链接到帖子的下一页。
<div class="pagination">
<span class="current"><span class="currenttext"><?php next_posts_link(esc_html__('Next', 'mythemeshop')); ?><</span></span>
<span class="current"><span class="currenttext"><?php previous_posts_link(esc_html__('Previous', 'mythemeshop')); ?></span></span>
</div>
评论前必须登录!
注册