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'm building a simple "company news/press release" site. We'd like to display the latest five post excerpts on the home page with the next three post titles (six through eight) and a single "Archives" button that takes the visitor to a new page that displays the sixth post and earlier.

I have the five post experts showing, but I can't get the other two things. Any help would be greatly appreciated!


UPDATE: Thanks, t-p, for the tip, but we need only the next three posts in the sidebar, not a duplicate of the first five and then the next three. In order words, the latest five will appear on the home page (already done) and posts 6 through 8 will appear in the sidebar only. Then, we want a link/button to take the visitor to a Archives page.

share|improve this question
    
In addition to displaying the latest five post excerpts on the home page (that you are already doing), in the "Recent Posts" widget in the sidebar, select eight posts (titles) to be displayed in the sidebar. –  Tara Dec 5 '12 at 17:58

1 Answer 1

$args  = array( 'numberposts' => 3, 'offset' => 5 );
$posts = get_posts( $args );

foreach( $posts as $post ){

  setup_postdata( $post );

  [output the post here with the_title(), the_content(), etc]

}

If you search in the codex with 'query posts', you will find a lot.

share|improve this answer

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.