title: Need custom pagination for wordpress loop
body: <p>I am using the following code, To display all post for a particular category</p>
  
  <pre><code>    &lt;?php
     $random_post = new WP_query(); 
    $random_post-&gt;query('cat='2'); 
    while ($random_post-&gt;have_posts()) : $random_post-&gt;the_post(); 
    the_title(); 
    endwhile;
    wp_reset_postdata();
  
  ?&gt;
  </code></pre>
  
  <p>And it is working fine but i need a custom pagination , i just want to display only 5 post in a page.if you have any idea please let me know asap.</p>