I am trying to get my pagination to work when using WP_Query on my static frontpage. But i am unable to.
This is the code i have at the moment:
<?php $the_query = new WP_Query( 'posts_per_page=3' );?> <?php while ( $the_query->have_posts() ) : $the_query->the_post();?> <h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4> <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?> <p><?php the_excerpt(); ?></p> <?php endwhile;?> <?php wp_reset_postdata();?>
(Not showing the next/previously post link thingies.)
Looking at the codex under WP_Query pagination i am supposed to add this:
$paged = (get_query_var('page')) ? get_query_var('page') : 1; $query = new WP_Query( 'paged=' . $paged );
I added the ‘paged=’ . $paged into the arguments of the function but it wont work. Am i doing something wrong? Something secret i have to do?
- The topic ‘Proper pagination with WP_Query. How to?’ is closed to new replies.