2017-11-04 3 views
0

私はwordpressを使用しています。 記事を分割してページ分割オプションを使用したいと思っています。しかし、それはページのページ設定を示しています! PrevとNex butonsを表示したいだけです。 この目的球は、そのように呼ばれて前と次のページの表示数を除外します

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)); ?> 

答えて

0

あなたが使用することができない出力ページ番号を行うnext_posts_linkprevious_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> 
関連する問題