Title: Next/Previous Navigation
Last modified: August 18, 2016

---

# Next/Previous Navigation

 *  bambilinh
 * [21 years, 9 months ago](https://wordpress.org/support/topic/nextprevious-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)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/nextprevious-navigation/#post-110473)
 * 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…
 *  [neurocide](https://wordpress.org/support/users/neurocide/)
 * (@neurocide)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/nextprevious-navigation/#post-111117)
 * 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!
 *  [sharmaine](https://wordpress.org/support/users/sharmaine/)
 * (@sharmaine)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/nextprevious-navigation/#post-111118)
 * 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](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](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](https://wordpress.org/support/topic/nextprevious-navigation/'.get_settings('siteurl').'/'.get_settings('blogfilename').$querystring_start.($qstr == '' ? '' : $qstr.$querystring_separator) .'paged'.$querystring_equal.'1)…‘;
   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.’](https://wordpress.org/support/topic/nextprevious-navigation/'.get_settings('siteurl').'/'.get_settings('blogfilename').$querystring_start.($qstr == '' ? '' : $qstr.$querystring_separator) .'paged'.$querystring_equal.$i.')‘;}}
   next_posts_link($nxtlabel, $max_page); if (($whichpage+2) < ($max_page)) echo‘…
   [Last Â»](https://wordpress.org/support/topic/nextprevious-navigation/'.get_settings('siteurl').'/'.get_settings('blogfilename').$querystring_start.($qstr == '' ? '' : $qstr.$querystring_separator) .'paged'.$querystring_equal.$max_page.')‘;
   echo ‘</b>’.$after; } } ?>
 *  [chuckblue](https://wordpress.org/support/users/chuckblue/)
 * (@chuckblue)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/nextprevious-navigation/#post-111142)
 * Aha ! the above lesterchan.net plugin works for me.
 *  [joebruin88](https://wordpress.org/support/users/joebruin88/)
 * (@joebruin88)
 * [21 years, 6 months ago](https://wordpress.org/support/topic/nextprevious-navigation/#post-111165)
 * 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&#8221](http://whatsbruin.net/images/l_arrow_plain.gif&#8221);
   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&#8221](http://whatsbruin.net/images/r_arrow_plain.gif&#8221);
   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.

 * 5 replies
 * 6 participants
 * Last reply from: [joebruin88](https://wordpress.org/support/users/joebruin88/)
 * Last activity: [21 years, 6 months ago](https://wordpress.org/support/topic/nextprevious-navigation/#post-111165)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
