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

  1. nida amin
    Posted 2 years 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));?>
                  <?php endwhile; ?>
                  <?php include(TEMPLATEPATH. '/inc/nav.php');?>

    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
    Posted 2 years 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