我的分頁鏈接對於自定義帖子類型失敗。在wordpress中自定義帖子類型的問題
頁面重新加載root/cat/page/2 /,但是這對顯示的帖子沒有影響。刷新永久鏈接結構沒有任何影響,所以我的猜測是問題出在查詢中。
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 10;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(array('post_type' => 'press',
'orderby' => 'post_date',
'posts_per_page' => $paged,
));
while ($wp_query->have_posts()) : $wp_query->the_post();
// The following determines what the post format is and shows the correct file accordingly
$format = get_post_format();
get_template_part('/lib/includes/post-formats/'.$format);
if($format == '')
get_template_part('/lib/includes/post-formats/standard');
endwhile;
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links(array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages
));
$wp_query = null; $wp_query = $temp; ?>
我最近幫助解決這裏像這樣的一個問題:http://stackoverflow.com/questions/18157591/wordpress-分頁定製循環不工作 – sulfureous