0

I want to add pagination to my front page last posts but i keep failing..! My code:

                    <?php
                        $recentPosts = new WP_Query();
                        $recentPosts->query('showposts=4&cat=3');
                    ?>
                <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
                    <div id="thepost">
                        <div class="view view-fifth">
                            <?php if ( has_post_thumbnail()) : the_post_thumbnail('thumbnail'); endif; ?>
                        <div class="mask">
                            <h2>title</h2>
                            <p><?php echo get_the_date(); ?></p>
                        </div>
                    </div>
                    <p class="posttitle"><a class="ajax" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>"><?php the_title(); ?></a></p>
                    <hr class="hr"/>
                    <p class="postcontent"><?php echo substr(strip_tags($post->post_content), 42, 120);?>...&nbsp;<a class="ajax" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">more...</a></p>
                    </div>
                <?php endwhile; ?>

I have ajaxify my "more..." button so i would like to do the same for the pagination :) Sorry for my bad enlish ...

Alt-Rock Ninja
  • 313
  • 3
  • 7

1 Answers1

1

You need to use query_posts insted of Wp_Query.

Some time pagination not working in Wp_Query.

Try this : 1) http://codex.wordpress.org/Function_Reference/query_posts 2) http://codex.wordpress.org/Function_Reference/paginate_links

Nisarg Patel
  • 260
  • 1
  • 8