title: Making Pagination work with home.php
body: <p>I can't seem to create a proper numeric pagination links on my <code>home.php</code> (i.e. the page containing all the posts sorted by date). Been scouring the WP developer handbook, Google and Stack Overflow for answers, to no avail. </p>
  
  <p>Here's how my <code>home.php</code> file looks so far:</p>
  
  <pre><code>&lt;?php get_header(); ?&gt;
  &lt;?php
  $paged = ( get_query_var( 'paged' ) ) ? get_query_var('paged' ) : '1';
  $args = array(
      'post_type' =&gt; 'post',
      'orderby' =&gt; 'date',
      'posts_per_page' =&gt; 5,
      'paged' =&gt; $paged
  );
  $the_query = new WP_Query($args);
  ?&gt;
  &lt;!-- The Main Loop is here --&gt;
  &lt;?php
  $big = 999999999; // need an unlikely integer
  
  echo paginate_links( array(
      'base' =&gt; str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
      'format' =&gt; '%#%',
      'current' =&gt; max( 1, get_query_var('paged') ),
      'total' =&gt; $the_query-&gt;max_num_pages
  ) );
  ?&gt;
  &lt;?php get_footer(); ?&gt;
  </code></pre>
  
  <p>In my development site, I have 7 sample posts. The first page (i.e. the  5 most recent posts) get rendered the way I want it. But when you click one of the numbered page links, it re-directs to the proper URL format but instead of using the <code>home.php</code> as the template file, it instead uses the <code>404.php</code>. I may be missing something here but I can't seem to figure out what.</p>
  
  <p>Any help would be appreciated.</p>