WordPress.org

Support

Support » How-To and Troubleshooting » Previous/Next Posts still not working

Previous/Next Posts still not working

Viewing 6 replies - 1 through 6 (of 6 total)
  • I had a same problem, but this is how I fixed it.

    In the file: template-functions-links.php
    Find the function: get_pagenum_link($pagenum = 1),
    Change $qstr = $_SERVER[‘REQUEST_URI’];
    to $qstr = $_POST[‘REQUEST_URI’];

    I believe this is caused by the php version that you are running in your server.

    Hope this will fix your problem!

    I tried this fix, but it isn’t working for me. My “previous entries” link at the bottom of my main page still brings up the current entries only. (Does work on individual post pages.) Any thoughts? Here is my blog: http://www.highlysensitivesouls.com/blog.

    I got the same problem as you, using 1.5.2. I went to your site (nice site, by the way) and noticed that when you go to category, and get a list, “previous entries” show up with the link:
    http://www.highlysensitivesouls.com/blog/?cat=10&paged=2
    I believe there should be an index.php before the ?cat.

    You have set up some kind of fix that redirects back to the previously displayed page, probably when it hits the 404.

    On mine, http://www.dmhaven.com/blog , when you click a category, any category, you get a previous entries link missing the index.php, like this:
    http://www.dmhaven.com/blog/?cat=4&paged=2
    Clicking the link displays a Not Found message.

    I shut down permalinks and deleted .htaccess, so that should not be a factor.

    There is another slightly different problem on the main page. The previous entry works on the main page. You can click the previous entry until you reach the first post. At this point, there should be no previous post, but it shows up anyway:
    http://www.dmhaven.com/blog/index.php?paged=4
    When you click there, you get a Not Found message, and a search box.

    Any help would be appreciated.

    Did some more testing. The problem goes away when I change the Options/Reading/Blog Pages from 1 per day to 10 per post. It’s working fine now, and I’m moderately happy. I would like to have the per day feature, but not if it causes problems.

    I don’t have enough entries yet to do further testing, but it looks like a bug that needs to be hunted down.

    p.s. I put permalinks back up, so some of the info in the post above may not apply.

    GOT IT!

    It’s ugly but it works. To get rid of the redundant subdomain, just subtract that part of the $index and $qstr strings that is giving the problems.

    To see what they originally were getting, I ran a trace script on the $_SERVER calls in the get_pagenum_link function:


    <?php
    echo $_SERVER['REQUEST_URI'];
    echo $_SERVER['PHP_SELF'];
    ?>

    This gave the orginating file as well as the subdomain. BINGO!

    Thus to lines 377 to 398 of template_functions_links.php, I added a substr php command to excise this problematic subdomain:


    $qstr = wp_specialchars($_SERVER['REQUEST_URI']);
    $qstr = substr ($qstr, 8);
    ...
    $index = $_SERVER['PHP_SELF'];
    $index = substr ($index, 6);

    The discrepancy in the substr calls are because I am getting %7E in $qstr, two characters more than the regular single ~ in $index.

    Thus in general, for $qstr, the number should be the length of subdomain name + 4, and for $index it should be +2.

    This seems to have cleared up other 404 errors originating from the login as well as all instances of previous/next entries misdirection.

    Would this fix the problem in my earlier post?

    http://wordpress.org/support/topic/80751?replies=8

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Previous/Next Posts still not working’ is closed to new replies.
Skip to toolbar