Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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(),
    );

Thanks

Prady

share|improve this question
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.