更改永久链接结构时,自定义页面模板分页不起作用


Custom page template pagination not working when permalink structure is changed

我在http://www.durgeshsound.com/gallery/这里我的分页按钮不起作用。当permalink格式为http://www.testsite.com/sample-post/但当我将permalink格式设置为默认格式时,例如http://testsite.com/?p=123然后它开始工作并创建一个工作的分页链接,如下所示http://www.durgeshsound.com/?page_id=81&paged=2.

我想要这种格式http://www.testsite.com/sample-post/在链接中。

这是我尝试的自定义页面模板

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                            query_posts('post_type=gallery&posts_per_page=9&paged=' . $paged);  ?>
                        <?php if (have_posts()) : while (have_posts()) : the_post(); 
                        if ( get_post_gallery() ) :
                            $gallery = get_post_gallery( get_the_ID(), false );
                    ?>  
                    <?php the_post_thumbnail('large'); ?> 
                            <?php the_title(  ); ?>                                  
                    <?php
                        endif;
                    endwhile;   endif;
                ?> 
            <?php kriesi_pagination(); ?>  
              <?php get_sidebar('gallery'); ?>

<?php get_footer(); ?>

请帮忙。

下面是自定义页面:用您的resp替换$cat。ID

<ul class="clearfix">
<?php  
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;   
$recentPosts = new WP_Query(); 
$recentPosts->query("cat=$cat&showposts=10&paged=".$paged); ?>
<?php  if($recentPosts){ ?>
<?php if ( $recentPosts->have_posts() ): while ($recentPosts->have_posts()) : $recentPosts->the_post();  ?>
<li id="post-<?php the_ID(); ?>" <?php post_class('interview-list'); ?>>
<div class="video-thumb">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php if(has_post_thumbnail()) {  
the_post_thumbnail(array(500,393));
}else {
echo '<img src="'.get_bloginfo("template_url").'/images/no-image.jpg" width="500px" height="393px"/>';
}
?>  </a>
</div>
<div class="image-con">
<div class="int-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</div>
</div>
</li>
<?php endwhile; ?>
<?php else: ?>
<h2 class="post-title">No Photos</h2>
<?php endif; ?>
<div class="older-link"><?php next_posts_link('&laquo; Older Entries', $recentPosts->max_num_pages) ?></div>
<div class="newer-link"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
<?php } ?>
</ul>