title: Pagination for custom post type on page template
body: <p>Hello I am trying to add pagination to a page template which I am using to display a custom post type. I have looked around for a few hours but I haven't come across clear set of instructions to follow.</p>
  
  <p>Below is all the code from my page template php file. If someone could point me in the right direction it would be much appreciated.</p>
  
  <p>I would appreciate any help on how to add the code for</p>
  
  <pre><code>&lt;?php
  /*
  Template Name: Testimonials
  */
  ?&gt;
  &lt;?php get_header(); ?&gt;
  &lt;div class="container_12"&gt;          
  
              &lt;div id="content" class="grid_8"&gt;           
                  &lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
                  &lt;div id="testimonials"&gt;                 
                      &lt;?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $testimonials = new WP_Query( array( 'post_type' =&gt; 'testimonial', 'orderby' =&gt; 'title', 'order' =&gt; 'ASC', 'posts_per_page' =&gt; '2', 'paged' =&gt; $paged) ); ?&gt;
                          &lt;?php if (have_posts()) : ?&gt;
                          &lt;ul&gt;
                              &lt;?php while ($testimonials-&gt;have_posts()) : $testimonials-&gt;the_post(); ?&gt;
                                  &lt;li&gt; 
                                      &lt;?php the_content(); ?&gt;
                                      &lt;span&gt;&lt;?php the_title(); ?&gt;&lt;/span&gt;                              
                                  &lt;/li&gt;       
                              &lt;?php endwhile; ?&gt;
                          &lt;/ul&gt;
                          &lt;?php else : ?&gt;  
                          &lt;p&gt;&lt;?php _e('No entry found.'); ?&gt;&lt;/p&gt;
                      &lt;?php endif; ?&gt;     
                      &lt;div class="navigation"&gt;
                     &lt;div class="alignleft"&gt;&lt;?php next_posts_link('« Older Entries') ?&gt;&lt;/div&gt;
                     &lt;div class="alignright"&gt;&lt;?php previous_posts_link('Newer Entries »') ?&gt;&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;&lt;!-- #testimonials --&gt;                
  
              &lt;/div&gt;&lt;!-- #content --&gt; 
  
                  &lt;?php get_sidebar(); ?&gt;                     
  
          &lt;/div&gt;
  &lt;?php get_footer(); ?&gt;
  </code></pre>
  
  <p>I'm able to access the page 2 with direct link testimonials/page/2/. But on page 1, the navigation does not appear.</p>
  
  <p><strong>Page 1:</strong> </p>
  
  <p><img src="https://i.stack.imgur.com/MhhjM.jpg" alt="enter image description here"></p>
  
  <p><strong>Page 2:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/f0Uyl.jpg" alt="enter image description here"></p>