Replace the boring « previous entries and next entries » with fancy paged navigation.
NOTE: This plugin should work on Wordpress versions less than 2.0, but it has only been tested on 2.0.5, 2.1 and 2.3. Please report any issues you have on older versions of Wordpress.
Usage
Quick Start
- Download yaapn.zip and unpack it.
- Upload
yaapn.phpto your plugins directory (usuallywp-content/plugins/) and activate the plugin in Administration Panel -
In your theme files find all occurences of following (or similar) code:
<div class="navigation">
<div class="alignleft"><?php
next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php
previous_posts_link('Next Entries »') ?></div>
</div>(in default theme, Kubrick, that will be in
index.php,archive.phpandsearch.php)Replace with:
<?php if (function_exists('paging')): paging(); else:?>
<div class="navigation">
<div class="alignleft"><?php
next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php
previous_posts_link('Next Entries »') ?></div>
</div>
<?php endif; ?> -
Now where
« Previous Entries
was, you should see something like this:
- Enjoy (:
Advanced
Styling
If you don’t like the default styles, change line 11 to your liking or uncomment line 12 and add appropriate definitions to your stylesheet (default class: paging, but you can change that in $template).
Parameters
paging ($count, $template, $template_item,
$prevlabel, $currentlabel, $nextlabel,
$firstlabel, $numberedlabel, $lastlabel,
$skipped, $separator);$count determines how many numbered links are displayed before and after current page (uses $skipped to indicate that some links are not displayed).
Setting $count to 0 will display links to all pages. WARNING: this may result in a really long list.
$template is the main navigation template.
$template_item is template for items in the numbered list.
Template variables
In $template you can use:
| Variable | Meaning |
|---|---|
| %NUMBERED% | list of numbered links to pages, separated with $separator |
| %COUNT% | pages count |
| %CURRENT% | current page number |
| %PREV% | link to previous page (if exists), uses $prevlabel |
| %PREV*% | link to previous page (if exists and not first), uses $prevlabel |
| %NEXT% | link to next page (if exists), uses $nextlabel |
| %NEXT*% | link to next page (if exists and not last), uses $nextlabel |
| %FIRST% | link to first page, uses $firstlabel |
| %LAST% | link to last page, uses $lastlabel |
| %SKIPB% | inserts $skipped if there were skipped links in the beginning of numbered list |
| %SKIPA% | inserts $skipped if there were skipped links in the end of numbered list |
In $template_item, $numberedlabel and $currentlabel you can use %NUMBER% to insert page number.
In $template_item you can use %ITEM%, which will be replaced with a link (using $numberedlabel) or $currentlabel.
In $lastlabel you can use %COUNT%.
Defaults
paging('<div class="paging"><h4>Page %CURRENT% of %COUNT%</h4>
<ul><li>%FIRST%</li>
<li>%PREV*%</li> %SKIPB% %NUMBERED% %SKIPA% <li>%NEXT*%</li>
<li>%LAST%</li></ul></div>’,
‚<li>%ITEM%</li>’, 2,
‚‹ previous’, ‚<b>%NUMBER%</b>’, ‚next ›’,
‚« first’, ‚%NUMBER%‚, ‚last »’, ‚<li> … </li>’, ”);Examples
paging('<div class="paging">
%FIRST% %PREV*% (%CURRENT% of %COUNT%) %NEXT*% %LAST%
</div>’);paging('<div class="paging">
%PREV% %SKIPB% %NUMBERED% %SKIPA% %NEXT%
</div>’,
‚%ITEM% ‚, 0);TODO
- Add option whether to hide or only deactivate %FIRST%, %PREV%, %NEXT% and %LAST%
- Administration Panel (?)
Changelog
- 1.05
- fixed a little bug that sometimes affected display of upload area in Admin Panel
- 1.04
- first public release
- 1.0 to 1.03
- private betas
Credits
Core idea based on WP-PageNavi by GaMerZ.
Copyright © YaaL 2006








November 24th, 2006 at 03:24
Just a thought, it would be nice to see an example. Would you know of any? Thanks.
November 24th, 2006 at 03:35
Michel, I use it in the journal — look just above the footer.
Edit: added a quick screenshot to the Basic Installation section.
November 24th, 2006 at 04:47
Perfect! Thank you.
November 24th, 2006 at 19:02
Wow! realy nice. Thanks.
November 26th, 2006 at 13:32
Great job :) Thanks for it :)
November 28th, 2006 at 04:35
Gr8 plugin, grats!
December 13th, 2006 at 19:33
tego właśnie szukałem, dzięki :)
December 22nd, 2006 at 00:10
Working great, been looking for a simple solution for awhile now!
December 28th, 2006 at 16:17
So I’m curious, what does it do over Gamerz PageNavi plugin, which I’m currently using?
December 28th, 2006 at 17:17
With WP-PageNavi, if you want something different from default format, you have to change the plugin. This one is customizable.
January 3rd, 2007 at 21:30
Thanks YaaL, I’ll give it a shot.
January 30th, 2007 at 18:28
Thank you for for this great plugin which I find the best for this type of work.
One suggest : would it be possible to add the CSS property in my own style sheet file rather than to add it in the main file (I mean in rather than in between the head tags).
Thanks.
January 30th, 2007 at 18:49
Me again just to say that the link to this page should be inside your plugin because it was hard for me to refind this page (I just understand French, English and Spanish and I used the WordPress Plugin Database to refind this link …)
February 8th, 2007 at 22:50
Awesome plugin just added it to my blog, thanks a lot for the effort!
March 2nd, 2007 at 21:18
whoa , very nice . it functions exactly.
April 19th, 2007 at 15:20
very nice! Perfect! Thank you.
October 11th, 2007 at 10:25
Thanks, for me the best navigation for WP, works perfect in 2.3
April 17th, 2008 at 13:36
Sorry, it doesn’t work. Did and followed every steps (1 to 3 in Quick start, I just need the simple one) you’ve mentioned above. What could be the problem? I tested specially category template and archives…. do I have to remove tags as well?
thanks..