我有一个奇怪的问题,为next&前几页不起作用。我似乎无法修复它。html似乎很好,数字也能工作,但点击后什么也没发生:http://sketchbookmagazine.com/category/fashion/
寻呼码:
function pagination($prev = '«', $next = '»') {
global $wp_query, $wp_rewrite;
$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
$pagination = array(
'base' => @add_query_arg('paged','%#%'),
'format' => '',
'total' => $wp_query->max_num_pages,
'current' => $current,
'prev_text' => __($prev),
'next_text' => __($next),
'type' => 'plain'
);
if( $wp_rewrite->using_permalinks() )
$pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
if( !empty($wp_query->query_vars['s']) )
$pagination['add_args'] = array( 's' => get_query_var( 's' ) );
echo paginate_links( $pagination );
};
html:
<div class="pagination"><?php pagination('«','»'); ?></div>
非常感谢您的帮助!
我从未见过这种构造:
$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
尝试将其更改为:
$current = $wp_query->query_vars['paged'] > 1 ? $wp_query->query_vars['paged'] : 1;