我有一个wordpress页面列出数据库中自定义表的输出。 使用wordpress的Pagination_link类,我想对输出进行分页,但生成的链接具有相同的链接,这导致重定向同一页面。 输出是这样的:
<div class="tablenav-pages" style="margin: 1em auto"><a class="prev page-numbers" href="/hireataxi/wp-admin/admin.php?page=dc-bookings&pagenum=2">«</a>
<a class="page-numbers" href="/hireataxi/wp-admin/admin.php?page=dc-bookings&pagenum=2">1</a>
<span class="page-numbers current">2</span>
<a class="page-numbers" href="/hireataxi/wp-admin/admin.php?page=dc-bookings&pagenum=2">3</a>
<a class="page-numbers" href="/hireataxi/wp-admin/admin.php?page=dc-bookings&pagenum=2">4</a>
<a class="page-numbers" href="/hireataxi/wp-admin/admin.php?page=dc-bookings&pagenum=2">5</a>
<a class="next page-numbers" href="/hireataxi/wp-admin/admin.php?page=dc-bookings&pagenum=2">»</a></div>
paginate_links类的设置类似于:
$total = $wpdb->get_var( "SELECT COUNT(`id`) FROM $table_name" );
$num_of_pages = ceil( $total / $limit );
$page_links = paginate_links( array(
'base' => add_query_arg( 'pagenum', '%#%' ),
'format' => '',
'prev_text' => __( '«', 'aag' ),
'next_text' => __( '»', 'aag' ),
'total' => $num_of_pages,
'current' => $pagenum
) );
if ( $page_links ) {
echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em auto">' . $page_links . '</div></div>';
}
我搜索了很多但却无法找到问题的原因。
答案 0 :(得分:1)
'add_args' => true,
默认情况下为false。