I am using the following code, To display all post for a particular category

    <?php
   $random_post = new WP_query(); 
  $random_post->query('cat='2'); 
  while ($random_post->have_posts()) : $random_post->the_post(); 
  the_title(); 
  endwhile;
  wp_reset_postdata();
?>

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.

Read more here: Need custom pagination for wordpress loop


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: