WordPress.org

Ready to get started?Download WordPress

Forums

navigation links redirects to 404 page on page 2 (2 posts)

  1. nida amin
    Member
    Posted 1 year ago #

    I have created custom post types in index.php

    <div class="achievements">
             <div class="achievement-header"><h3>Achievements</h3></div>
                <?php query_posts('showposts=3&post_type=achievements&paged='.$paged); ?>
                <?php while (have_posts() ) : the_post(); ?>
                 <div class="achievement-images">
                <?php echo the_post_thumbnail(array(218,265));?>
                </div>
                  <?php endwhile; ?>
                  <?php include(TEMPLATEPATH. '/inc/nav.php');?>
               </div>

    When I click on older entries, it gets redirected to error 404 page i.e It displays 404 page on page 2. Please help me...

  2. vtxyzzy
    Member
    Posted 1 year ago #

    The code you posted does not show a value set for $paged. If it is not set in earlier lines, try changing this line:

    <?php query_posts('showposts=3&post_type=achievements&paged='.$paged); ?>

    to this:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=3&post_type=achievements&paged='.$paged); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic