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 have been googling for the past 2 hours and haven't been able to figure this out, mainly because I am missing the right terminology, in other words, I don't know what I want in "wordpress words".

What I want is a custom ¿page? that will display the header (get_header()) and below it it will be a list of the last 5 published posts and it should go like this:

Title of the post

Text of the post

Times five for the last five.

Underneath it there should be a link to "Older posts" that links to the next five (older) posts.

I'm told this is an archive but the documentation on Archive doesn't help to accomplish this, neither do the tutorials I've found.

What is the easiest way to do this?

share|improve this question
add comment

1 Answer

I found the actual answer in a stackoverflow question.

Quoted from the answer:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array( 'post_type' => 'post', 'posts_per_page' => 10, 'paged' => $paged );
$wp_query = new WP_Query($args);
while ( have_posts() ) : the_post(); ?>
    <h2><?php the_title() ?></h2>
<?php endwhile; ?>

<!-- then the pagination links -->
<?php next_posts_link( '&larr; Older posts' ); ?>
<?php previous_posts_link( 'Newer posts &rarr;' ); ?>
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.