我看不到变量$additional_loop
在代码中的任意位置设置。如果你对WP-Pagenavi, 安装它并修改代码,如下所示:
<?php
//You need to handle the \'paged\' query var for pagination!
$paged = (get_query_var(\'paged\'))?get_query_var(\'paged\'):1;
$loop = new WP_Query(array(\'post_type\' => \'portfolio\', \'posts_per_page\' => 2, \'paged\' => $paged));
?>
更换以下部件:
<!-- Next/Previous Posts -->
<?php if (function_exists("pagination")) {
pagination($additional_loop->max_num_pages);
} ?>
使用:
<?php
if(function_exists(\'wp_pagenavi\'))
{
wp_pagenavi();
}
else
{ ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link(\'Previous entries\') ?></div>
<div class="alignright"><?php previous_posts_link(\'Next entries\') ?></div>
</div>
<?php }
?>
希望这有帮助!