I want to build a loop where the first 2 posts of category 8 are shown on the first page and to display pagination under the loop, so if there are more posts the visitor can navigate to them with "next page" "previous page" links.
I use
<?php posts_nav_link(); ?>
for pagination but thera are no links shown. I think maybe I should try to add the parameter 'paged' to my loop, the problem is that I don't know how to do this. Any help would be greatly appreciated!
<?php
$args = array( 'numberposts' => 2, 'category' => 8 );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post); ?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(20); ?>
<div id="pagenav">
<?php posts_nav_link(); ?>
</div>
<?php endforeach; ?>