Support » Fixing WordPress » pagination with wp_query

  • Resolved goldmember


    on this page i’m using the following code to pull in the 25 most recent posts from category 4.

    $custom_query = new WP_Query( 'posts_per_page=25&cat=4' );
    if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
    <h3><?php the_title(); ?></h3>
    <?php the_content(); ?>
    <hr class="homenews" />
    <?php endwhile; else : ?>
    No posts were found.
    <?php next_post(); ?>
    <?php endif; ?>

    but how do i add a link at the bottom of the page that says “click here for earlier posts”, and leads to a page that lists the 25 items posted before that???

    please advise. thanks in advance.

  • The topic ‘pagination with wp_query’ is closed to new replies.