I have a wordpress page that shows the latest news. I want to paginate these news, and this is my code:
<?php query_posts('posts_per_page=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="news">
<h1><a href="<?php the_permalink(); ?>" rel="news" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<p>
<?php the_excerpt(); ?>
</p>
</div>
<?php endwhile; ?>
<p>
<?php wp_pagenavi(); ?>
</p>
<?php wp_reset_query(); ?>
I have this code in a page content, i'm using exec-php plugin to parse the code. The problem is that when I click on page 2 I still see the news of the page 1. So pagination isn't working.
Any idea?
On my archive (archive.php) page i've tried the pagination too, but there when I click on page 2 I'm redirected on the homepage instead.
Help me please!