WordPress.org

Ready to get started?Download WordPress

Forums

BLOG - PREVIOUS ENTRIES- Page Not Found (4 posts)

  1. frogontop
    Member
    Posted 5 years ago #

    I upgraded my wordpress and now for some reason the 'previous entries' link at the bottom of http://www.ganisco.com/blog/ comes up with 'page not found'

    has anyone else experienced this issue?

    i tried using:

    <?php
    $offset = "0";
    $no_of_posts = "10";
    if (preg_match('/blog/page/', $_SERVER['REQUEST_URI'])) {
    $uri = explode('/', $_SERVER['REQUEST_URI']);
    foreach ($uri as $key=>$value) {
    if ($value == "") {
    unset($uri[$key]);
    }
    }
    $offset = (array_pop($uri) * 2) - 2;
    }
    query_posts('showposts=' . $no_of_posts . '&amp;offset=' . $offset);
                if (have_posts()) : while (have_posts()) : the_post();
    
            ?>

    to no avail, please help.

  2. Chris_K
    Member
    Posted 5 years ago #

    Have you tried resetting your Permalinks? Switch back to default, test, and then switch back to whatever you currently have and see if that helps.

  3. mattifesto
    Member
    Posted 5 years ago #

    I don't quite know how to fix it, but I know two things that make the error stop.

    First, my error was getting "page not found" on the LAST previous page of links on the main index page. The page would actually show up correctly, but "Page not found" would be in the title. If I had a 404.php it would cause that to be invoked.

    First fix:

    1. Changing permalinks to "Default" will fix it. But nobody's going to do that. (By the way I totally did all the .htaccess stuff others talk about, it didn't help for this case.)

    2. Removing this line from my theme and changing number of posts per page from 9 to 6 in settings instead also fixed the problem:

    query_posts($query_string . '&posts_per_page=6');

    For me, that gets the same result.

    I'm guessing, and right now it's just a guess, that when post_per_page is set and doesn't match the post per page in the settings, that wordpress potentially gets confused. Part of it says, "Hey, I've calculated and at 9 posts per page there is no page 3! Page not found!" And then another part says, "Well there actually is a page 3 because I'm currently using 6 posts per page. So I'll just return the results."

    If anyone else experiments and finds similar (or conflicting) results, please post about them.

  4. electronish
    Member
    Posted 4 years ago #

    ! Eureka Eureka !

    My case was:
    My theme was passing in the argument: 'posts_per_page'=>7
    While my wordpress settings ( setting > reading > Blog pages show at most ) was 10

    Solution:
    Match the 'posts_per_page'=>7 TO the setting > reading > Blog pages show at most = 7 ANd it will FIX !

Topic Closed

This topic has been closed to new replies.

About this Topic