Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-PageNavi |
Version | 2.00 |
Comparing to | |
See all releases |
Version 2.00
- pagenavi.php +66 -0
- readme-install.txt +19 -0
- readme.txt +14 -0
pagenavi.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.0
|
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 |
+
echo "$before Pages ($max_page): <b>";
|
46 |
+
if ($paged >= 4) {
|
47 |
+
echo '<a href="'.get_pagenum_link().'">« First</a> ... ';
|
48 |
+
}
|
49 |
+
previous_posts_link($prelabel);
|
50 |
+
for($i = $paged - 2 ; $i <= $paged +2; $i++) {
|
51 |
+
if ($i >= 1 && $i <= $max_page) {
|
52 |
+
if($i == $paged) {
|
53 |
+
echo "[$i]";
|
54 |
+
} else {
|
55 |
+
echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
next_posts_link($nxtlabel, $max_page);
|
60 |
+
if (($paged+2) < ($max_page)) {
|
61 |
+
echo ' ... <a href="'.get_pagenum_link($max_page).'">Last »</a>';
|
62 |
+
}
|
63 |
+
echo "$after</b>";
|
64 |
+
}
|
65 |
+
}
|
66 |
+
?>
|
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 the 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,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 January 2006
|
10 |
+
--------------------------------------------------
|
11 |
+
|
12 |
+
// Version 2.00 (01-01-2006)
|
13 |
+
- NEW: Compatible With WordPress 2.0
|
14 |
+
- FIXED: Space Issues
|