WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] pagination with wp_query (1 post)

  1. goldmember
    Member
    Posted 3 years ago #

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

    <?php
    $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 : ?>
    <h3>Sorry...</h3>
    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.

Topic Closed

This topic has been closed to new replies.

About this Topic