2017-11-04 7 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>