这是我的密码
if($totalPage > 1){
$customPagHTML = paginate_links(
array(
\'base\' => add_query_arg( \'cp\', \'%#%\' ),
\'format\' => \'\',
\'prev_text\' => __(\'Back\', \'«\'),
\'next_text\' => __(\'Next\', \'»\'),
\'total\' => $totalPage,
\'current\' => $page,
\'type\' => \'\'
)
);
}
echo $customPagHTML;
链接显示如下:-站点。com/页/?cp=2
但我想展示一下:site.com/page/cp/2 或site.com/page/2
注意:从自定义db表获取结果
$query = "SELECT * FROM custom_table WHERE custom_table.id = \'$id\'";
SO网友:obiPlabon
你不需要做任何额外的工作!只需移除format
和base
参数,您将获得此格式的URLsite.com/page/2
. 顺便说一句,我已经把你的背和下一个翻译搞定了。
if ( $totalPage > 1 ) {
echo paginate_links(
array(
\'prev_text\' => __( \'Back «\', \'text-domain\' ),
\'next_text\' => __( \'Next »\', \'text-domain\' ),
\'total\' => $totalPage,
\'current\' => $page,
)
);
}