Custom page template pagination not working when permalink structure is changed

I created a page template at http://www.durgeshsound.com/gallery/
Here my pagination buttons are not working. this issue arises when permalink format is http://www.testsite.com/sample-post/
But when I set permalink format to default for example http://testsite.com/?p=123 then it starts working
and creates a working pagination link like this http://www.durgeshsound.com/?page_id=81&paged=2.

I want this format http://www.testsite.com/sample-post/ in the links.

Read More

here is what i tried for custom page template

<?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(); ?>

Please help.

Related posts

Leave a Reply

1 comment

  1. Below is custom Page : Replace $cat with your resp. 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>