Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-PageNavi |
Version | 1.00 |
Comparing to | |
See all releases |
Version 1.00
- pagenavi.php +48 -0
- readme.txt +29 -0
pagenavi.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Page Navigation
|
4 |
+
Plugin URI: http://www.lesterchan.net/portfolio/programming.php
|
5 |
+
Description: Adds a more advanced page navigation to Wordpress.
|
6 |
+
Version: 1.5
|
7 |
+
Author: GaMerZ
|
8 |
+
Author URI: http://www.lesterchan.net
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
### Page Navigation
|
13 |
+
function wp_pagenavi($before=' ', $after=' ', $prelabel='« ', $nxtlabel=' »') {
|
14 |
+
global $request, $posts_per_page, $wpdb, $paged;
|
15 |
+
if (!is_single()) {
|
16 |
+
if (get_query_var('what_to_show') == 'posts') {
|
17 |
+
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
18 |
+
$fromwhere = $matches[1];
|
19 |
+
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
|
20 |
+
$max_page = ceil($numposts /$posts_per_page);
|
21 |
+
} else {
|
22 |
+
$max_page = 999999;
|
23 |
+
}
|
24 |
+
if(empty($paged)) {
|
25 |
+
$paged = 1;
|
26 |
+
}
|
27 |
+
echo "$before Pages ($max_page) : <b>";
|
28 |
+
if ($paged >= 4) {
|
29 |
+
echo '<a href="'.get_pagenum_link().'">« First</a> ... ';
|
30 |
+
}
|
31 |
+
previous_posts_link($prelabel);
|
32 |
+
for($i = $paged - 2 ; $i <= $paged +2; $i++) {
|
33 |
+
if ($i >= 1 && $i <= $max_page) {
|
34 |
+
if($i == $paged) {
|
35 |
+
echo "[$i]";
|
36 |
+
} else {
|
37 |
+
echo '<a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
next_posts_link($nxtlabel, $max_page);
|
42 |
+
if (($paged+2) < ($max_page)) {
|
43 |
+
echo ' ... <a href="'.get_pagenum_link($max_page).'">Last »</a>';
|
44 |
+
}
|
45 |
+
echo "$after</b>";
|
46 |
+
}
|
47 |
+
}
|
48 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-> Page Navigation Plugin For WordPress
|
2 |
+
--------------------------------------------------
|
3 |
+
Author -> Lester 'GaMerZ' Chan
|
4 |
+
Email -> lesterch@singnet.com.sg
|
5 |
+
Website -> http://www.lesterchan.net/
|
6 |
+
Demo -> http://www.lesterchan.net/blogs
|
7 |
+
Updated -> 16th June 2005
|
8 |
+
--------------------------------------------------
|
9 |
+
|
10 |
+
|
11 |
+
-> Installation Instructions
|
12 |
+
--------------------------------------------------
|
13 |
+
// Open wp-content/plugins folder
|
14 |
+
|
15 |
+
Put:
|
16 |
+
------------------------------------------------------------------
|
17 |
+
pagenavi.php
|
18 |
+
------------------------------------------------------------------
|
19 |
+
|
20 |
+
|
21 |
+
// Activate the pagenavi plugin
|
22 |
+
|
23 |
+
|
24 |
+
// Open wp-content/themes/<YOUR THEME NAME>/footer.php
|
25 |
+
|
26 |
+
Add:
|
27 |
+
------------------------------------------------------------------
|
28 |
+
<?php wp_pagenavi()?>
|
29 |
+
------------------------------------------------------------------
|