WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to show all the posts of a particular category on my home page. There are over 70 posts in that category. I would like have a pagination so that only 10 posts are displayed and have pagination set so users can move to next page by clicking the page nos. Can this be possible? Here is the current code that i have

   global $post;
        $args = array( 'numberposts' => 5, 'offset'=> 0, 'ORDER BY'=>'date', 'order'=>'desc','category' => 1 );
        $myposts = get_posts( $args );
        foreach( $myposts as $post ) :  setup_postdata($post); 
          //  while(have_posts()):the_post();
            $attrs = array(
        'src'   => $src,
        'class' => "",
        'alt'   => get_the_title(),
        'title' => get_the_title(),



share|improve this question

Have a look at the examples on the Codex for get_posts();

As for pagination, there are many plugins available, this one for example : WP-Paginate

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.