• I was testing WordPress in localhost, posting articles to see how is working, everything fine, untill I had to much articles in one page and I had to go to the second page using the pagination, well I clicked the second page, but I got a 404 Not Found Page.

    I looked for about 2-3 hours, tried every function, every example but the result was the same.

    The home page is a static front page, is called Landing, and all the articles are set to the Blog page.

    My php code from index.php:

    <div class="container-medium">
        <div class="row">
    
            <?php while(have_posts()) : the_post(); ?>
            <div class="col-xs-12 col-sm-12 col-md-12">
                <?php the_post_thumbnail('post-thumbnail', array( 'class'   => "img-responsive desaturate attachment-post-thumbnail")); ?>
                <h3 class="blog-post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                <div class="row">
                    <div class="col-sm-12"><p class="blog-post-text"><?php echo get_excerpt(); ?></p></div>
                    <div class="col-sm-12"><a class="btn btn-sm btn-readmore" href="<?php echo get_permalink(); ?>">Read more <i class="icon-right-open"></i></a></div>
                </div>
            <hr class="dotted">
        </div>
    
        <?php endwhile; wp_reset_query(); ?>
        </div> <!-- end .row -->
                <?php if ( have_posts() ) : ?>
    
        <!-- Add the pagination functions here. -->
    
        <!-- Start of the main loop. -->
        <?php while ( have_posts() ) : the_post();  ?>
    
        <!-- the rest of your theme's main loop -->
    
        <?php endwhile; ?>
        <!-- End of the main loop -->
    
        <!-- Add the pagination functions here. -->
    
        <div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
        <div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>
    
        <?php else : ?>
        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
        <?php endif; ?>
    
    </div> <!-- end .container-medium -->

    I read a bunch of similar questions but I don’t get the result that I want.

    Thank you!

    PS: PHP Beginner
    PS1: I tried to change the permalinks, and is working with the default structure (website.com/?p=123).

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Page 2 not found (404) Pagination’ is closed to new replies.