WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] is_paged (); on index.php not working? (11 posts)

  1. wexy
    Member
    Posted 9 years ago #

    I have a problem with is_paged (); on index.php and archive.php. I use this code to control the display of the part with page navigation.

    <?php if (is_paged ()) { ?>
    <div class="navigation_in">
    <div style="float:left"><?php posts_nav_link('','','« Previous Entries') ?></div>
    <div style="float:right"><?php posts_nav_link('','Next Entries »','') ?></div>
    </div>
    <?php } ?>

    But is_paged (); just doesn't return any value.. I'm using 1.5.1.3. Can anyone help?
    Thanks!

  2. cynics
    Member
    Posted 9 years ago #

    is_paged() only will give value if the page is a Page ... note the cap "P" ...

  3. Minna
    Member
    Posted 9 years ago #

    is_paged() will only give value if you are on a subpage of the archives or main page...

  4. wexy
    Member
    Posted 9 years ago #

    Codex says: "is_paged(): When the page being displayed is "paged". This refers to an archive or the main page being split up over several pages..."

  5. wexy
    Member
    Posted 9 years ago #

    Well ... index.php is main page right? :)

  6. Minna
    Member
    Posted 9 years ago #

    yeah, but you'd need to be on a page 2+ of index.php. I should've said "subpage of the archives or subpage of main page".
    At least that's how it works for me

  7. Joshua Sigar
    Member
    Posted 9 years ago #

    Hmm, never used this one, but I thought it's for a Post with several pages (the one using that <!--nextpage--> or some sort)
    You just have to try to find out, I guess.

  8. wexy
    Member
    Posted 9 years ago #

    Ok I understand now, is there another way to control the display of this navigation links, if I leave them and there are no previous or next entries it leaves a nice anoying gap :) ?

  9. wexy
    Member
    Posted 9 years ago #

    @alphaoide: The Codex says it's not for that.. it says: "When the page being displayed is "paged". This refers to an archive or the main page being split up over several pages. This does not refer to a Post or Page whose content has been divided into pages using the <!--nextpage--> QuickTag."

  10. cynics
    Member
    Posted 9 years ago #

    oh pardon me. i saw wrongly. ;) its past bed-time...

  11. wexy
    Member
    Posted 9 years ago #

    Solved the problem, found this plugin http://www.lesterchan.net/portfolio/programming.php and it works nicely, just fixed some formating errors.

Topic Closed

This topic has been closed to new replies.

About this Topic