WordPress.org

Ready to get started?Download WordPress

Forums

Next/Previous Links not working (37 posts)

  1. jhob
    Member
    Posted 6 years ago #

    I have been scratching my head on this one for quite a while but have not come up with a solution after much searching on these boards.

    My problem is that the next and previous links don't work on my blog: http://johnhobsonphotography.com/blog/

    The URL displayed in the address bar is correct, e.g. http://johnhobsonphotography.com/blog/page/2/ but only the front page of my blog is shown. I am using next_posts_link and previous_posts_link.

    I have put the code from the page up at pastebin: http://pastebin.com/f249e7350

    Could anyone point me in the right direction for how to get this working, I would be really grateful!

    thanks,
    John

  2. jhob
    Member
    Posted 6 years ago #

    I'm still stuck with this one if anyone is able to offer help?

  3. khaledelhage
    Member
    Posted 6 years ago #

    jhob,

    I'm having the same problem on my blog (http://khaledelhage.com), and didn't find any helping resources so far. I've noticed though, that if you remove "blog" from the URL on your blog (i.e., http://johnhobsonphotography.com/page/2/), you are pointed to the right page.

    The url I get when I click "Previous Entries" on my blog is:
    http://khaledelhage.com/index.php/Index.php/page/2/

    Notice that "index.php" appears twice. If I remove it from the URL, I get the right behaviour.

    Our problems seem to have a common source. I'm sensing that this have something to do with permalinks. My blog runs under IIS.

    Hope that one of the bright minds behind WordPress can help us out with this one.

    Thanks,
    khaled

  4. haochi
    Member
    Posted 6 years ago #

    @jhob
    Do you have the .htaccess in your root directory and is it config right?

    @khaled
    You can try to change code, remove the posts_nav_link() function in your index.php and replace it with something like
    <a href="http://khaledelhage.com/index.php/page/<?php echo $paged+1; ?>/">Older Entries</a>

  5. khaledelhage
    Member
    Posted 6 years ago #

    Thanks haochi, that's a patch that works better than what I'm getting now. But it has some problems at the limits of the navigation. I think I need to detect the reaching of the last page and hide the link. Since I'm not "fluent" in php, I guess I'm going to apply your patch for now. Readers of my blog will get a "page not found" message when all pages are navigated, which is way better than what they're getting now.

    Thanks again.

  6. itissue
    Member
    Posted 6 years ago #

    I have the same problem as jhob had. I'm using the WP Page Navi plugin, and it worked just fine before, but now I have a static homepage. I used the Settings > Reading > Front page displays - A static page (select below) route, so I don't actually have a separate folder for the blog, but all blog entries are under http://endless-sonata.net/blog.

    Here's my site if you want to see what I mean:
    http://endless-sonata.net/

    I have seen this method used before and it worked, but somehow it's not working for me. When I go to
    http://endless-sonata.net/blog/page/2/
    it stays as the same page as the first page of the blog.

  7. jberghem
    Member
    Posted 6 years ago #

    khaledelhage

    The index.php is not listed twice in your link. One is index.php and the other is Index.php if your blog is running on a linux or unix server then they are 2 different documents as these servers are case sensitive. Get rid of the Index.php, it may not solve this problem but keeping it there is not going to help. (do download a copy of the file so you can compare them)

  8. malakhi
    Member
    Posted 6 years ago #

    I'm having this same issue too and I don't really understand your solution. How do you remove "Index.php"?

    You can see my site here: http://malakhi.net/blog

    Thanks!

  9. nark3d
    Member
    Posted 6 years ago #

    I had the same problem, but I found a work around:

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

    And continue your loop. Use the next_posts_link and previous_posts_link as you normally would.

    Have a look at it in action here:
    http://adamlewis.me.uk

  10. nark3d
    Member
    Posted 6 years ago #

    oops, missed a bit:`

    $offset = "0";
    $no_of_posts = "2";
    if (preg_match('/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 . '&offset=' . $offset);
    if (have_posts()) :`

    That should work.

  11. elenaberu
    Member
    Posted 6 years ago #

    Hi Adam,

    And where exactly do we have to paste that code? Our theme's index.php? and where exactly? which lines?

    Thank you very much!

    Elena

  12. chaoskaizer
    Member
    Posted 6 years ago #

    there is two possible thing that i can think of why it doesnt show

    1. post is less than "max page per post" range.
    2. outside of loop scope (doesnt have post)

    try add the below code above the next/prev code. ( just to make sure )

    <?php rewind_posts();?>
  13. skaufmann
    Member
    Posted 6 years ago #

    I'm having a similar problem but in my case my nav links when viewing a category strip out the category info form the URL and it goes to the next page of the main archive.

    When I go to
    http://www.karieandscott.com/blog/category/gallery
    and select next page, it goes to
    http://www.karieandscott.com/blog/page/2
    rather than
    http://www.karieandscott.com/blog/category/gallery/page/2

    I've been going crazy to figure this out. I have no idea when it started.

  14. f1f
    Member
    Posted 5 years ago #

    Hi everyone.

    I'm experiencing a similar problem but with a difference:

    When I create a gallery in a page, the next/previous image navigation works fine.

    When I create a gallery in a post, the next/previous image navigation doesn't work at all.

    Can anyone think what might be causing this?

    I'm on WordPress 2.6.0

  15. babynow
    Member
    Posted 5 years ago #

    Me, too.

    I have almost been crazy. What should I do to solve this big problem.

    See my previous entries:

    http://website.iflove.com/index.php/Index.php/page/2/
    http://blog.iflove.com/index.php/page/2/

    I have no way but manually add "Older Posts" with the right link:

    http://blog.iflove.com/index.php/page/2/
    http://website.iflove.com/index.php/page/2/
    http://trip.iflove.com/index.php/page/2/

    I really hope WordPress or someone could solve this issue. I have been crazy for this since I have no good way to troubleshoot it.

  16. daitoku
    Member
    Posted 5 years ago #

    I have run into the same problem. Perhaps we need to be looking at the htaccess file instead of the php...alas I am not versed in that area.

  17. bubi
    Member
    Posted 5 years ago #

    Hi!
    I have the same problem. The Previous/Next links are not shown in the page, but are called in the template using "posts_nav_link()" function. It is strange that the Manage Posts, Comments,... also lack the Next, Previous links. I remember that all the navigation worked in the previous versions of WP (before 2.6, mybe even 2.5), but then it stopped working. i have not made any change in the template files or WP configuration. The links are not working even if I create new clean WP install and fill in new posts. What If this has something to do with the server configuration? Using Apache.
    Regards;
    Luka

  18. bubi
    Member
    Posted 5 years ago #

    Did a clean install of WP 2.0.11 and Next, Previous links are working. What can I do to make them work in 2.6 or at least upcoming 2.7?

  19. jberghem
    Member
    Posted 5 years ago #

  20. bubi
    Member
    Posted 5 years ago #

    @jberghem: Read that, tried that, failed that.
    The template is the same since WP 2.0. Somewhere in the development of the WP the navigation stopped working. The template did not change much, at least not in that section. I will rewrite it someday, perhaps that will help.
    What interests me the most is that the navigation inside WP admin area is not working. I can only browse through first page of posts, comments, etc. There is no way for me to get to pages with older posts. So this is not related to my theme.
    However, everything works perfectly if I downgrade WP to 2.0.11. But I really do not want to do that :)

  21. jberghem
    Member
    Posted 5 years ago #

    You can try with these:
    <?php next_post_link(); ?> and <?php previous_post_link(); ?>

  22. bubi
    Member
    Posted 5 years ago #

    @jberghem: Thanks. I have tried that, but with zero success. I even left the "and" in between the php tags, and that word is the only one displayed on the page. Do you have any insight where the navigation on my admin panel has gone? Please look at the picture at this link: "http://www.bubi.si/wp_admin_panel.jpg". There you can see I have 251 posts, but there is no navigation how to get to the 7th page of posts. The same story is with comments. I do not have any idea why is that, I have not alter the WP installation in any way. As I said before, everything works with 2.0.11. I think if I manage to figure out why the admin page is not working correctly than the front page will start behaving like it should. I hope you have any insight into what is happening.

  23. jberghem
    Member
    Posted 5 years ago #

    Hmmm. This sort of thing can happen when you upgrade but don't delete the wp-admin and wp-includes folders from the server first. You really must delete them and not just overwrite them. (I had similar problems with options disappearing on me in the admin area because I had overwritten the folder instead of deleting it.)

    Do backup any files in those folders that you customized if you have any.

    Who knows, this may be the root of your link problem since WP 2.0.11 used <?php next_post(); ?> and <?php previous_post(); ?> which are now depreciated and have been replaced with <?php next_post_link(); ?> and <?php previous_post_link(); ?> The only wp-* folders and files I don't delete from the server before upgrading are the wp-content folder and the wp-config.php

  24. bubi
    Member
    Posted 5 years ago #

    I deleted all files from my WP folder, and upgraded to 2.6.3. i uploaded my theme, uploads directory and wp-config.php. The problem is still there. I have only changed the wp-config.php file and locale.php. I hoped that the problem lies within locale.php, but even with the original file the problem is there. Is there any configuration on the server, that might cause this strange behavior? Any change between 2.0 and 2.6 that might cause this? The page is running on Apache, MySql and PHP 5.2.5.

  25. jberghem
    Member
    Posted 5 years ago #

    Are you using a cache plugin like wp-cache or super-cache, did you clear them and your browser cache as well?

    It's really weird if none of that works. I mean, sure a lot has changed between 2.0 and 2.6 but when you've deleted everything from 2.0 there shouldn't be anymore problems like this.

    I too have it running on Apache, MySQL and PHP5 some things like the permalinks may give you problems if you don't have certain mod's enabled in your php.ini but I don't see how this applies to the next and previous links. It's worth a try to set the permalinks to the default setting but I don't know if it'll help you any. (if the permalinks worked before they should be working now)

    If you have the option of adding a subdomain to your account (like: http://test.bubi.si) where you can do a clean install of WP and see if everything is working like it's supposed to? That way you can eliminate the server configuration as the problem.

  26. bubi
    Member
    Posted 5 years ago #

    I can not manage subdomain without help of server admin, so I have set up new WP install into new directory using old domain. New WP 2.6.3 files, old database, new table prefix therefor no data in the tables. I have changed only wp-config.php file to allow access to my database. I did use defauld WP theme. Cleared browser cache, even tried using Google Chrome in Private mode. I entered new posts into this new WP installation. The problem still here. I guess this indicates some server misconfiguration. But where to look. Oh, yes, I did use default link structure. Any idea what to look on the server or what data to post here so somebody could look into this?

  27. jberghem
    Member
    Posted 5 years ago #

    Well it would be the server if the default permalinks would work but pretty permalinks wouldn't. But since they both don't work I doubt the server is the issue. Have you looked at and tried all the previous suggestions in this post? Have you tried creating a new .htaccess file as suggested by others?

    Looking back on everything that's suggested in this post I don't have a clue what else I could suggest you try.

  28. jsomerton
    Member
    Posted 5 years ago #

    I found this thread helped:

    http://wordpress.org/support/topic/211585

  29. rogerr
    Member
    Posted 5 years ago #

    My problem is slightly different.

    Previous and Next work perfectly well until I have a set of posts that are in the same category but Private....Then the links refuse to show...any ideas???

    Using 2.6.3

  30. davex
    Member
    Posted 5 years ago #

    I too found that all of my links that referred to other pages or individual posts in my blog caused a sort of circular logic error and would fail to a 404 or TRY AGAIN page.

    I fixed it (after several hours of searching etc) by

    :: downloaded the current version of WordPress

    :: went to http://YOUR BLOG NAME/blog/wp-admin/plugins.php page and deactivated all plugins

    :: deleted the wp-admin and wp-includes directories in the /blog folder

    :: copied the new WordPress files (not the folder, but it's content's) into the /blog directory

    :: went to http://YOUR BLOG NAME/blog/wp-admin/ to check for db error messages

    :: went to http://YOUR BLOG NAME/blog/wp-admin/plugins.php page and RE-activated all plugins

    :: MOST IMPORTANT STEP!!! Went to http://YOUR BLOG NAME/blog/wp-admin/options-permalink.php and made sure DEFAULT is chose under COMMON SETTINGS (mine was set to DAY/TIME) and click SAVE CHANGES

    and it worked better than ever!

Topic Closed

This topic has been closed to new replies.

About this Topic