title: Wordpress Loop Pagination inside custom single template
body: <p>I tried many solutions and changes and i can't get the pagination working on a post_type loop inside a single template.</p>
  
  <p>This is the last code i tested:</p>
  
  <pre><code>&lt;?php 
      $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;
      $wp_query = new WP_Query(); 
      $wp_query-&gt;query('post_type=some_listing&amp;taxonomy=some_listing_category&amp;field=ID&amp;posts_per_page=2'.'&amp;terms='.$someterm .'&amp;paged='.$paged);  
  ?&gt;
  
  &lt;?php if( $wp_query-&gt;have_posts() ): ?&gt;
  &lt;?php while ( $wp_query-&gt;have_posts() ) : $wp_query-&gt;the_post(); ?&gt;
  
  // loop
  
  &lt;?php endwhile; ?&gt;
  
  &lt;?php
      next_posts_link( 'Older Entries', $the_query-&gt;max_num_pages );
      previous_posts_link( 'Newer Entries' );
  ?&gt;
  
  &lt;?php wp_reset_postdata(); ?&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>Also i have this on the functions.php file:</p>
  
  <pre><code>add_action('template_redirect', function() {
      if ( is_singular('areas') ) {
          global $wp_query;
          $page = (int) $wp_query-&gt;get('page');
          if ( $page &gt; 1 ) {
            // convert 'page' to 'paged'
            $query-&gt;set( 'page', 1 );
            $query-&gt;set( 'paged', $page );
          }
          // prevent redirect
          remove_action( 'template_redirect', 'redirect_canonical' );
      }
  }, 0 );
  </code></pre>