0

我有一个奇怪的问题,即为下一页和上一页生成的箭头不起作用。我似乎无法修复它。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>

任何帮助是极大的赞赏!

4

1 回答 1

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;
于 2012-07-19T14:56:54.043 回答