有人知道为什么我的分页不起作用吗?我可以显示“上一页”,但当导航到“第2页”时,内容将与“第1页”上的内容保持一致。
<?php
/*
Template Name: Generic Trips Template
*/
?>
<?php get_header(); ?>
<?php get_template_part( "beforeloop", "page" ) ?>
<?php $types = $post->post_name; ?>
<?php if (have_posts()) : ?>
<?php $paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1; query_posts(array( \'post_type\' => \'trips\', \'types\' => $types, "posts_per_page" => 5)); ?>
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" class="post">
</article>
<?php endwhile; ?>
<?php if(function_exists(\'wp_pagenavi\')) : ?>
<div class="pnavi">
<?php wp_pagenavi(); ?>
</div>
<?php else : ?>
<div class="alignleft"><?php next_posts_link(__(\'« Older Entries\')); ?></div>
<div class="alignright"><?php previous_posts_link(__(\'Newer Entries »\')); ?></div>
<?php endif; ?>
<?php endif; wp_reset_query(); ?>
<?php get_template_part( "afterloop", "page" ) ?>
<?php get_footer(); ?>