WordPress.org

Ready to get started?Download WordPress

Forums

posts_nav_link generates /page/2/ instead of ?paged=2 (7 posts)

  1. lexingtonic
    Member
    Posted 6 years ago #

    The setup:

    WP 2.2.1
    http://www.phulicohanmd.com/
    Static page as homepage, defined in home.php
    Blog at http://www.phulicohanmd.com/drphulisblog/, defined in drphulisblog.php

    I recently changed the location of the blog from /drphulisnotebook/ to /drphulisblog/
    and since then, the posts_nav_link does not function properly. Here's what happens:

    On the first page of posts, the Next link it creates points to drphulisblog/page/2/, which brings up the first page of posts again. However, if I modify the address in the address bar of the first page to be /drphulisblog/index.php?paged=1, then the Next link it creates points to drphulisblog/index.php?paged=2 and it brings up the next page of posts no problem.

    Then, if I'm on drphulisblog/index.php?paged=2, it generates the link to the third page properly (drphulisblog/index.php?paged=3), but the link back to the first page of posts is only drphulisblog/index.php, and so once the first page loads again, the Next link at the bottom is once again drphulisblog/page/2/ which has the same problem of reloading the first page over and over again.

    Here is the drphulisblog.php code:

    <?php
    /*
    Template Name: Dr. Phuli's Blog
    */

    // Which page of the blog are we on?
    $paged = get_query_var('paged');
    query_posts(‘cat=-0&paged=’.$paged);

    //load index to show blog
    load_template(TEMPLATEPATH . '/index.php');
    ?>

    And here is the code that generates the Next/Previous links inside the index.php file:

    <p style="margin-top:30px;"><?php posts_nav_link('  |  ', __('« Previous Posts'), __('More Posts »')); ?></p>

    I've tried going into /wp-includes/link-template.php to see if I could figure things out, but I'm not a PHP programmer and came up empty.

    So, can anyone tell me how to prevent WordPress from generating links in the /page/#/ format?

    Thanks!

    Diane

  2. Joni
    Member
    Posted 6 years ago #

    You have pretty permalinks turned on, that's why it is rendering this way. The old way, there were no pretty permalinks.

    http://codex.wordpress.org/Using_Permalinks

  3. lexingtonic
    Member
    Posted 6 years ago #

    That's the thing, because all of the posts are in a "subdirectory", I have to customize the permalinks, even the default p=# one to point to /drphulisblog/ otherwise the first page of posts doesn't even show up when going to http://phulicohanmd.com/drphulisblog/

    I've tried every combination possible and nothing changes...

    Any specific instructions on how to get around this?

    I had pretty permalinks turned on before I changed /drphulisnotebook/ to /drphulisblog/, and the posts_nav_link Previous and Next links worked fine.

  4. Joni
    Member
    Posted 6 years ago #

    That's the thing, because all of the posts are in a "subdirectory", I have to customize the permalinks....

    Under Options in the Dashboard, did you tell WP that your blog is in that subdirectory? Doing that should ensure that you don't need to do any further configuration regarding permalinks or other directory structure type stuff.

  5. lexingtonic
    Member
    Posted 6 years ago #

    It seems as though that is for the situation where you want your blog in your root directory, but WordPress in a subdirectory so that it doesn't clutter up the root folder.

    Also, when I tried entering /drphulisblog/ for the Blog Address, all of a sudden going to http://www.phulicohanmd.com/drphulisblog/ wouldn't load the posts, only the static page I have set as the home page at http://www.phulicohanmd.com/. Only if I typed in "http://www.phulicohanmd.com/drphulisblog/index.php?paged=1 did it show the posts.

    Thoughts? (And thanks for your continued efforts!)

  6. Joni
    Member
    Posted 6 years ago #

    Hmm. I have always set up WP in the root so I've never personally encountered this problem. Hopefully one of the WP gurus will be along shortly to help. :)

  7. lexingtonic
    Member
    Posted 6 years ago #

    I sure hope so!

    WP is actually in the root folder. I've used WP options to set a static page as the home page, and the "blog" part, called "Dr Phuli's Blog" is defined to be in a 'subfolder' by a PHP file drphulisblog.php. It seems as though this PHP file imitates a separate folder, because I don't actually have a drphulisblog folder in the root directory, so it seems as though it's just a path generated on-the-fly by the php file.

    The maddening thing is that the links were all working fine, and then I had to go and change the name of the blog part from "Dr Phuli's Notebook" to "Dr Phuli's Blog". I'm pretty sure I changed it everywhere it needed to be changed, but now the links decide to not render properly.

    This one is just a bit too far over my head!

    Gurus? Help? Please? :)

    Diane

Topic Closed

This topic has been closed to new replies.

About this Topic