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.php
to 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.php
andsearch.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
Just a thought, it would be nice to see an example. Would you know of any? Thanks.
Michel, I use it in the journal — look just above the footer.
Edit: added a quick screenshot to the Basic Installation section.
Perfect! Thank you.
Wow! realy nice. Thanks.
Great job :) Thanks for it :)
Gr8 plugin, grats!
tego właśnie szukałem, dzięki :)
Working great, been looking for a simple solution for awhile now!
So I’m curious, what does it do over Gamerz PageNavi plugin, which I’m currently using?
With WP-PageNavi, if you want something different from default format, you have to change the plugin. This one is customizable.
Thanks YaaL, I’ll give it a shot.
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.
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 …)
Awesome plugin just added it to my blog, thanks a lot for the effort!
whoa , very nice . it functions exactly.
very nice! Perfect! Thank you.
Thanks, for me the best navigation for WP, works perfect in 2.3
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..
Great plugin, thanks for sharing with us.
[…] more here: YaaL//home » Yet Another Advanced Paged Navigation Comments0 Leave a Reply Click here to cancel […]
Hi. This plugin not working in WordPress 3. Plugin not correctly count the number of pages.
Sorry for bad english.