我将此代码用于自定义分页:
global $wpdb, $table_prefix, $current_user;
get_currentuserinfo();
$umail = $current_user->user_email;
$paged = $wpdb->get_results("SELECT * FROM {$table_prefix}comments WHERE comment_author_email = \'$umail\'");
$page = isset($_GET[\'page\']) ? (int) $_GET[\'page\'] : 1;
$pages = COUNT($paged);
$pages = ceil($pages / 2);
$querystring = "";
foreach ($_GET as $key => $value) {
if ($key != "page") $querystring .= "$key=$value&";
}
// Pagination
for ($i = 1; $i <= $pages; $i++) {
echo "<a " . ($i == $page ? "class=\\"selected\\" " : "");
echo "href=\\"?{$querystring}page=$i";
echo "\\">$i</a> ";
}
此代码分页我的注释如下:1 2 3 4 5 6 7 8 9 10 11
如何更改代码以获得如下分页:1 2 3。。。11
谢谢你的帮助。