WordPress.org

Ready to get started?Download WordPress

Forums

Bug in index.php - doesn't "posts paged" (18 posts)

  1. Jaykul
    Member
    Posted 10 years ago #

    What's going on with the "posts paged" option? I set my reading option to 10 posts paged ... and it doesn't seem to "page" anything. I'm using the default index.php.
    Then, I go on the IRC channel, and people tell me I have to add code to make it work? What's going on?

  2. OperaManiac
    Member
    Posted 10 years ago #

    <?php posts_nav_link() ?>

  3. Anonymous
    Unregistered
    Posted 10 years ago #

    The problem with <?php posts_nav_link() ?> is that it generates invalid code (lonely ampersands) for monthly archives. You get:
    &entity=keyword
    instead of:
    &entity=keyword
    And that is both invalid, and crashes the blog in XML mode.
    M.
    p.s. Hello, Sush.

  4. carthik
    Member
    Posted 10 years ago #

    Jaykul, the posts_paged is only for posts, by default, like if you have a long post, you can page it, http://chrisjdavis.org usually does.
    To get everything else to page, you have to get http://scriptygoddess.com 's paginate plugin.

  5. carthik
    Member
    Posted 10 years ago #

    What was the last post about? Jaykul? Was it an error you got or something?

  6. Jaykul
    Member
    Posted 10 years ago #

    Heh, yeah! Hopefully the edit clears things up. I'm still convinced that "posts paged" is the same as "posts."

  7. carthik
    Member
    Posted 10 years ago #

    Jaykul, it reads show most recent 10 posts or days or 10 individual-posts-each-split-up-as-pages.
    The following post is an example of a paged post
    http://chrisjdavis.org/index/2004/05/24/per-post-copyright-for-12/514/

  8. Jaykul
    Member
    Posted 10 years ago #

    Uhm. This an example of a paged post:
    http://www.huddledmasses.org/2004/05/13/
    And I have my settings set to "posts" now because it makes no difference

  9. OperaManiac
    Member
    Posted 10 years ago #

    post paged option make that tag give previous page next page links.
    and they are outside the loop.
    i think you are looking for page numbers for a single post :p

  10. Jaykul
    Member
    Posted 10 years ago #

    Shushubh: I believe you! (I think)
    My point is: You have to add code to index.php to make that happen. So the feature ships broken. When a (new) user changes that option, NOTHING happens. They have to go find out that they have to put "posts_nav_link()" _INSIDE_ the content div ...

  11. carthik
    Member
    Posted 10 years ago #

    Setting posts_paged as an option enables one to use
    the posts_nav_link() tag to display post navigation on index.php, without posts_paged being set, putting posts_nav_link() on your index.php will have no effect (won't produce the "previous", "next" nav links).
    Cleared this up after a small experiment :)

  12. ringmaster
    Member
    Posted 10 years ago #

    I had this same issue. I couldn't figure out why the site wouldn't page when the option was on, but eventually stumbled across the nav tags.
    Yeah, so... Shouldn't it ship with the code in and the option off as opposed to the code out and the option on?

  13. OperaManiac
    Member
    Posted 10 years ago #

    hmm this tag is a good candidate to appear in default template..... :)

  14. Jaykul
    Member
    Posted 10 years ago #

    Well, I made it work on my site, in my own personal, but extremely immitable, way.
    http://www.huddledmasses.org/2004/05/28/prev-next_links/

  15. minimal
    Member
    Posted 10 years ago #

    If it helps, I have posted a diff to allow permalinks to be used along with posts_paged:
    http://wordpress.org/support/10/6425
    Thanks for mentioning the missing posts_nav_link() call - I was wondering what I was doing wrong, and would second the suggestion to place this line in the default index.php file (deciding between posts and posts_paged as a default setting is not something I have an opinon on).
    TTFN,
    --
    ian.

  16. minimal
    Member
    Posted 10 years ago #

    Hmm, just read the source of Jaykul's plugin, and I think I prefer it over the above diff, mainly due to the way permlinks will look afterwards...
    Wish I'd looked at the code before I started messing around with stuff.
    Oh well.
    --
    ian.

  17. minimal
    Member
    Posted 10 years ago #

    Hi again,
    Two quick changes to Jaykul's code and it's working for multiple categories and search terms.
    To get multiple categories working I had to allow / symbols in the category part of the URL in the .htaccess rewrites, so I changed the first RewriteRule to read:
    RewriteRule ^category/(.*)?page/?([0-9]{1,})?/? /index.php?category_name=$1&paged=$2 [QSA,L]
    which works (ie: anything after category and page at the end of the URL), and I don't think causes damage elsewhere.
    I also had a problem with search terms having two ampersands in the next page URL, which meant that it failed to go to the correct page. To get it working, simply change one line in the get_pagenum_link function, shortly after the if stristr line to:
    $qstr .= $querystring_separator.$page_querystring.$querystring_equal.$pagenum;
    The $querystring_equal is declared global above this point but never used, so it's just a small typo.
    HTH,
    --
    ian.

  18. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    posts_nav_link() will be in the default template in 1.3 and will have permalink support for both rewrite rules and path info.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.