Quantcast
Channel: Wordpress API » pagination
Viewing all articles
Browse latest Browse all 2

wordpress pagination with query_posts

$
0
0

Mostly people use the query_posts function for fetching the specific posts. But most of all people face issue with pagination.

Just use following code for pagination. It is simple and easy.

<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( 'post_type=documents&paged='.$paged );
query_posts( 'post_type=post&paged='.$paged );
if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php the_excerpt();  ?>

 <?php endwhile; ?>
<div id="nav-below" class="navigation">
                                        <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
                                        <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
                                </div><!-- #nav-below -->
                                  <?php endif; wp_reset_query(); ?>

wordpress pagination with query_posts

wordpress pagination with query_posts

Incoming search terms:

Follow us on Twitter WordPress API


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images