WordPress.org

Support

Support » Themes and Templates » Next/Previous Links not working

Next/Previous Links not working

Viewing 15 replies - 1 through 15 (of 36 total)
  • jhob
    Participant

    @jhob

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

    khaledelhage
    Member

    @khaledelhage

    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

    @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>

    khaledelhage
    Member

    @khaledelhage

    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.

    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.

    John
    Member

    @jberghem

    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)

    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!

    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

    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.

    elenaberu
    Member

    @elenaberu

    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

    chaoskaizer
    Member

    @chaoskaizer

    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();?>
    skaufmann
    Member

    @skaufmann

    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.

    f1f
    Member

    @f1f

    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

    babynow
    Member

    @babynow

    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.

    daitoku
    Member

    @daitoku

    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.

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘Next/Previous Links not working’ is closed to new replies.