我有一个奇怪的问题,为下一个&以前的页面不起作用。我似乎无法解决它。 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>
非常感谢任何帮助!
答案 0 :(得分:0)
我从未见过这种结构:
$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;