WordPress.org

Ready to get started?Download WordPress

Forums

Archive.php help (7 posts)

  1. ZNetDev
    Member
    Posted 4 years ago #

    Hello all,
    I have the default archive.php template all made up. My client has asked that if there is a post which has more than one page, a link be provided reading "NEXT PAGE". If the post is not paged then nothing will be showed. I've been trying various things for the past couple days, and I've just not succeeded. Can anyone point in the direction/provide an example of how I might achieve this?

    Thanks,
    Stephen

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    do you mean, if someone entered <!--nextpage--> into the txt of a post?

    try this:
    <?php if(wp_link_pages('echo=0')) { echo 'this page/post has more than one part'; }; ?>
    in the loop where you show the post titles(?).

    http://codex.wordpress.org/Template_Tags/wp_link_pages

  3. ZNetDev
    Member
    Posted 4 years ago #

    nope, that didn't work either :(

  4. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    could you stick your archive.php into a pastebin (with the position marked where you want that 'NEXT PAGE' link) so someone can have a look at it?

    what are your test posts like?

    btw: in what way did it not work?
    link never showing? link always showing? error message?

  5. ZNetDev
    Member
    Posted 4 years ago #

    HERE IT IS.

    @alchymyth: It just doens't show up or detect it.

  6. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    line 37 and 46:

    <?php if(wp_link_pages('echo=1')) { echo 'this page/post has more than one part'; }; ?>

    should read 'echo=0' - last try for today ;-)

  7. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    btw: 'echo=1' is the default, and would echo the links as described in the codex (here is the link again: http://codex.wordpress.org/Template_Tags/wp_link_pages).
    'echo=0' would return a string, which can then be used (tested, worked with etc.)

    if you examine single.php of the default theme, they are using 'wp_link_pages' in the loop after the_content.

Topic Closed

This topic has been closed to new replies.

About this Topic