tags:

views:

40

answers:

1

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!

A: 

As far as I know Wordpress reject any URL query parameters that it doesn’t recognise.

Even if you solved that problem, this function

<?php query_posts('posts_per_page=5'); ?>

does not accept the page parameter so it seems "obvious" showing always page 1. I don't know the code inside it so I could be wrong.

I've found this link to solve the first problem: http://www.webopius.com/content/137/using-custom-url-parameters-in-wordpress

dierre
I assume query_posts() takes the parameters and automatically adjust the query based on 'current_page' parameter. I don't know the code inside too. :o
fabrik