WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] pagination with wp_query

[Resolved] pagination with wp_query

  • 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.

  • The topic ‘[Resolved] pagination with wp_query’ is closed to new replies.
Skip to toolbar