如何在 url 中传递附加参数以使分页工作
我现有的页面链接是http://localhost/site/wp-admin/admin.php?page=myPage
如何在PHP中创建语法/逻辑以添加&pagenum=1
到 url?
目前我有这个代码
global $wpdb;
$per_page = 6;
$page_query = $wpdb->get_var("SELECT COUNT('id') FROM form");
$pages = ceil($page_query / $per_page);
$currentPage = (isset ($_GET['pagenum'])) ? (int)$_GET['pagenum'] : 1;
$start = ($currentPage -1 ) * $per_page;
$row = $wpdb->get_results("SELECT * FROM form LIMIT $start , $per_page");
//foreach loop here