Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-PageNavi |
Version | 2.01 |
Comparing to | |
See all releases |
Version 2.01
- pagenavi.php +68 -0
- readme-install.txt +19 -0
- readme.txt +17 -0
pagenavi.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP-PageNavi
|
4 |
+
Plugin URI: http://www.lesterchan.net/portfolio/programming.php
|
5 |
+
Description: Adds a more advanced page navigation to Wordpress.
|
6 |
+
Version: 2.01
|
7 |
+
Author: GaMerZ
|
8 |
+
Author URI: http://www.lesterchan.net
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/* Copyright 2005 Lester Chan (email : gamerz84@hotmail.com)
|
13 |
+
|
14 |
+
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License as published by
|
16 |
+
the Free Software Foundation; either version 2 of the License, or
|
17 |
+
(at your option) any later version.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27 |
+
*/
|
28 |
+
|
29 |
+
|
30 |
+
### Function: Page Navigation
|
31 |
+
function wp_pagenavi($before=' ', $after=' ', $prelabel='«', $nxtlabel='»') {
|
32 |
+
global $request, $posts_per_page, $wpdb, $paged;
|
33 |
+
if (!is_single()) {
|
34 |
+
if (get_query_var('what_to_show') == 'posts') {
|
35 |
+
preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
|
36 |
+
$fromwhere = $matches[1];
|
37 |
+
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
|
38 |
+
$max_page = ceil($numposts /$posts_per_page);
|
39 |
+
} else {
|
40 |
+
$max_page = 999999;
|
41 |
+
}
|
42 |
+
if(empty($paged)) {
|
43 |
+
$paged = 1;
|
44 |
+
}
|
45 |
+
if($max_page > 1) {
|
46 |
+
echo "$before Pages ($max_page): <b>";
|
47 |
+
if ($paged >= 4) {
|
48 |
+
echo '<a href="'.get_pagenum_link().'">« First</a> ... ';
|
49 |
+
}
|
50 |
+
previous_posts_link($prelabel);
|
51 |
+
for($i = $paged - 2 ; $i <= $paged +2; $i++) {
|
52 |
+
if ($i >= 1 && $i <= $max_page) {
|
53 |
+
if($i == $paged) {
|
54 |
+
echo "[$i]";
|
55 |
+
} else {
|
56 |
+
echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
next_posts_link($nxtlabel, $max_page);
|
61 |
+
if (($paged+2) < ($max_page)) {
|
62 |
+
echo ' ... <a href="'.get_pagenum_link($max_page).'">Last »</a>';
|
63 |
+
}
|
64 |
+
echo "$after</b>";
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
?>
|
readme-install.txt
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-> Installation Instructions
|
2 |
+
--------------------------------------------------
|
3 |
+
// Open wp-content/plugins folder
|
4 |
+
|
5 |
+
Put:
|
6 |
+
------------------------------------------------------------------
|
7 |
+
pagenavi.php
|
8 |
+
------------------------------------------------------------------
|
9 |
+
|
10 |
+
|
11 |
+
// Activate WP-PageNavi plugin
|
12 |
+
|
13 |
+
|
14 |
+
// Open wp-content/themes/<YOUR THEME NAME>/footer.php
|
15 |
+
|
16 |
+
Add:
|
17 |
+
------------------------------------------------------------------
|
18 |
+
<?php wp_pagenavi(); ?>
|
19 |
+
------------------------------------------------------------------
|
readme.txt
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-> Page Navigation Plugin For WordPress 2.0
|
2 |
+
--------------------------------------------------
|
3 |
+
Author -> Lester 'GaMerZ' Chan
|
4 |
+
Email -> gamerz84@hotmail.com
|
5 |
+
Website -> http://www.lesterchan.net/
|
6 |
+
Demo -> http://www.lesterchan.net/blogs
|
7 |
+
Documentation -> http://dev.wp-plugins.org/wiki/wp-pagenavi
|
8 |
+
Development -> http://dev.wp-plugins.org/browser/wp-pagenavi/
|
9 |
+
Updated -> 1st March 2006
|
10 |
+
--------------------------------------------------
|
11 |
+
|
12 |
+
// Version 2.01 (01-02-3006)
|
13 |
+
- FIXED: Paging Show If There Is Only 1 Page
|
14 |
+
|
15 |
+
// Version 2.00 (01-01-2006)
|
16 |
+
- NEW: Compatible With WordPress 2.0
|
17 |
+
- FIXED: Space Issues
|