Support » Plugins » Next/Previous Navigation

  • Are there any Next/Prev navigation plugins for posts? I know that there is the Scripty Goddess one, but it doesn’t seem to work for me; only the “Home” link shows up, not the previous/next. So, is there another way to automatically add prev/next navigation? Or perhaps someone can help me with the one from Scripty Goddess? Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Mark (podz)

    (@podz)

    Support Maven

    I have this, and I think it works in 1.2 …..
    <?php if ($single) { ?>
    <center>
    <?php previous_post('%', '', 'yes', 'no', 1, '') ?>
    < < || Home || > >
    <?php next_post('%', '', 'yes', 'no', 1, '') ?>
    </center>
    <?php } ?>

    That goes directly above this line:
    <div class="post">
    Obviously you’ll need to alter a couple of details…

    I’m sorry, I’m really lost. I’m using WP 1.2.1 and Kubrick 1.2.6 and when I click on an individual entry’s permalink, on that individual post’s page it shows the previous and next posts up on the top. But what I want to have is that on my main page it shows the 5 latest entries and then at the bottom have a link saying Next Page, which then goes to the next 5 entries, and so on. I also want this to happen on when I view my posts by category or by month.

    I’ve looked at the other next/previous posts, but they aren’t very helpful to me. Could anyone help me out please? Thank you very much!

    Am not sure if this would help but i find this somewhere in the site a couple of months ago.

    =========
    <?php
    /*
    Plugin Name: Page Navigation
    Plugin URI: http://www.lesterchan.net/portfolio/programming.php
    Description: Adds A Page Navigation To Your WordPress. Please Make Sure Post Paged Is Turned On.
    Version: 1.2
    Author: GaMerZ
    Author URI: http://www.lesterchan.net
    */

    function page_navigation($before=”, $after=”, $prelabel=’« ‘, $nxtlabel=’ »’) {
    global $p, $what_to_show, $request, $posts_per_page, $wpdb;
    global $HTTP_SERVER_VARS, $paged;
    global $querystring_start, $querystring_equal, $querystring_separator;
    if (empty($p) && ($what_to_show == ‘paged’)) {
    $nxt_request = $request;
    $whichpage = $_GET[‘paged’];
    if(empty($whichpage)) $whichpage = 1;
    $qstr = $HTTP_SERVER_VARS[‘QUERY_STRING’];
    if (!empty($qstr)) {
    $qstr = preg_replace(“/&paged=\d{0,}/”,””,$qstr);
    $qstr = preg_replace(“/paged=\d{0,}/”,””,$qstr);
    } elseif (stristr($HTTP_SERVER_VARS[‘REQUEST_URI’], $HTTP_SERVER_VARS[‘SCRIPT_NAME’] )) {
    if (” != $qstr = str_replace($HTTP_SERVER_VARS[‘SCRIPT_NAME’], ”, $HTTP_SERVER_VARS[‘REQUEST_URI’]) ) {
    $qstr = preg_replace(“/^\//”, “”, $qstr);
    $qstr = preg_replace(“/paged\/\d{0,}\//”, “”, $qstr);
    $qstr = preg_replace(“/paged\/\d{0,}/”, “”, $qstr);
    $qstr = preg_replace(“/\/$/”, “”, $qstr);
    }
    }
    if ($pos = strpos(strtoupper($request), ‘LIMIT’)) {
    $nxt_request = substr($request, 0, $pos);
    }
    $nxt_result = $wpdb->query($nxt_request);
    $numposts = $wpdb->num_rows;
    $max_page = ceil($numposts / $posts_per_page) ;

    echo $before.’Pages (‘.$max_page.’) : <b>’;
    if ($whichpage >= 4)
    echo ‘« First … ‘;
    previous_posts_link($prelabel);
    for($i = $whichpage – 2 ; $i <= $whichpage +2; $i++) {
    if ($i >= 1 && $i <= $max_page) {
    if($i == $whichpage)
    echo ‘[‘.$i.’] ‘;
    else
    echo ‘‘.$i.’ ‘;
    }
    }
    next_posts_link($nxtlabel, $max_page);
    if (($whichpage+2) < ($max_page))
    echo ‘ … Last »‘;
    echo ‘</b>’.$after;
    }
    }
    ?>

    Aha ! the above lesterchan.net plugin works for me.

    I using the following:

    <?php if ($single) { ?>
    <div class=”menu top-menu”>
    <span class=”prev”>
    <img src=”http://whatsbruin.net/images/l_arrow_plain.gif” alt=”l_arrow_plain.gif” align=”middle” /> <?php previous_post(‘%’, ”, ‘yes’, ‘no’, 1, ”) ?></span>
    <span class=”next”><?php next_post(‘%’, ”, ‘yes’, ‘no’, 1, ”) ?> <img src=”http://whatsbruin.net/images/r_arrow_plain.gif” alt=”r_arrow_plain.gif” align=”middle” /></span>
    </div>

    <?php } ?>

    But I am trying to “hide” the right arrow when the Permalink is displaying the most recent post.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Next/Previous Navigation’ is closed to new replies.