我已經添加了我的Wordpress主題中的自定義帖子類型的分頁。它的效果很好,除了在分頁菜單中顯示的帖子數量太多:http://www.electrickiwi.co.uk/testimonials/WordPress的分頁 - 帖子數量太多頁面
目前應該有7個頁面,但它顯示了12個。下面的代碼是我用來顯示分頁。這與functions.php文件中沒有任何關係。
<?php
/* ------------------------------------------------------------------*/
/* PAGINATION */
/* ------------------------------------------------------------------*/
//paste this where the pagination must appear
global $wp_query;
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ($total > 1) {
// get the current page
if (!$current_page = get_query_var('paged')) {
$current_page = 1;
}
// structure of "format" depends on whether we're using pretty permalinks
if (get_option('permalink_structure')) {
$format = 'page/%#%/';
}
else {
$format = 'page/%#%/';
}
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
'current' => $current_page,
'total' => $total,
'mid_size' => 4,
'type' => 'list'
));
}
?>
謝謝您的回答解決了這個問題。當我刪除它時,它只是完全刪除頁面的分頁。 – rossautomatica