Version Description
- Added
wp_paginate_comments()
function for pagination of post comments
Download this release
Release Info
Developer | emartin24 |
Plugin | WP-Paginate |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1
- I18n/wp-paginate.pot +39 -42
- readme.txt +52 -13
- wp-paginate.css +2 -2
- wp-paginate.php +73 -42
I18n/wp-paginate.pot
CHANGED
@@ -6,9 +6,9 @@
|
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
-
"Project-Id-Version:
|
10 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-paginate\n"
|
11 |
-
"POT-Creation-Date: 2009-09-
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -16,157 +16,154 @@ msgstr ""
|
|
16 |
"Content-Type: text/plain; charset=CHARSET\n"
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
|
19 |
-
#: wp-paginate.php:
|
20 |
msgid "Settings"
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: wp-paginate.php:
|
24 |
msgid "Success! Your changes were successfully saved!"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: wp-paginate.php:
|
28 |
msgid "Whoops! There was a problem with the data you posted. Please try again."
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: wp-paginate.php:
|
32 |
msgid "Pagination Text:"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: wp-paginate.php:
|
36 |
msgid "The text to display before the list of pages."
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: wp-paginate.php:
|
40 |
msgid "Previous Page Text:"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: wp-paginate.php:
|
44 |
msgid "The text to display for the previous page link."
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: wp-paginate.php:
|
48 |
msgid "Next Page Text:"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: wp-paginate.php:
|
52 |
msgid "The text to display for the next page link."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: wp-paginate.php:
|
56 |
msgid "Advanced Settings"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: wp-paginate.php:
|
60 |
msgid "Before Markup:"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: wp-paginate.php:
|
64 |
msgid "The HTML markup to display before the pagination code."
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: wp-paginate.php:
|
68 |
msgid "After Markup:"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: wp-paginate.php:
|
72 |
msgid "The HTML markup to display after the pagination code."
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: wp-paginate.php:
|
76 |
msgid "Markup Display:"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: wp-paginate.php:
|
80 |
msgid "Always show Markup, even when the page list is empty?"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: wp-paginate.php:
|
84 |
msgid "CSS File:"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: wp-paginate.php:
|
88 |
msgid "Deselect this option to prevent loading wp-paginate.css."
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: wp-paginate.php:
|
92 |
msgid "Page Range:"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: wp-paginate.php:
|
96 |
msgid ""
|
97 |
"The number of page links to show before and after the current page. "
|
98 |
"Recommended value: 3"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: wp-paginate.php:
|
102 |
msgid "Page Anchors:"
|
103 |
msgstr ""
|
104 |
|
105 |
-
#: wp-paginate.php:
|
106 |
msgid ""
|
107 |
"The number of links to always show at beginning and end of pagination. "
|
108 |
"Recommended value: 1"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: wp-paginate.php:
|
112 |
msgid "Page Gap:"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: wp-paginate.php:
|
116 |
msgid ""
|
117 |
"The minimum number of pages in a gap before ellipses (...) are added. "
|
118 |
"Recommended value: 3"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: wp-paginate.php:
|
122 |
msgid "Need Support?"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: wp-paginate.php:
|
|
|
126 |
msgid ""
|
127 |
"For questions, issues or feature requests, please post them in the %s and "
|
128 |
"make sure to tag the post with wp-paginate."
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: wp-paginate.php:
|
132 |
msgid "Like To Contribute?"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: wp-paginate.php:
|
136 |
msgid ""
|
137 |
"If you would like to contribute, the following is a list of ways you can "
|
138 |
"help:"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: wp-paginate.php:
|
142 |
msgid "Translate WP-Paginate into your language"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: wp-paginate.php:
|
146 |
msgid "Blog about or link to WP-Paginate so others can find out about it"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: wp-paginate.php:
|
150 |
msgid "Report issues, provide feedback, request features, etc."
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: wp-paginate.php:
|
154 |
msgid "Rate WP-Paginate on the WordPress Plugins Page"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: wp-paginate.php:
|
158 |
msgid "Make a donation"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: wp-paginate.php:
|
162 |
msgid "Other Links"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: wp-paginate.php:364
|
166 |
-
msgid "My Blog"
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
#. Description of an extension
|
170 |
-
msgid "
|
|
|
171 |
msgstr ""
|
172 |
-
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
+
"Project-Id-Version: 1.1\n"
|
10 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-paginate\n"
|
11 |
+
"POT-Creation-Date: 2009-09-10 03:50+0000\n"
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
16 |
"Content-Type: text/plain; charset=CHARSET\n"
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
|
19 |
+
#: wp-paginate.php:253
|
20 |
msgid "Settings"
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: wp-paginate.php:278
|
24 |
msgid "Success! Your changes were successfully saved!"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: wp-paginate.php:281
|
28 |
msgid "Whoops! There was a problem with the data you posted. Please try again."
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: wp-paginate.php:293
|
32 |
msgid "Pagination Text:"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: wp-paginate.php:295
|
36 |
msgid "The text to display before the list of pages."
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: wp-paginate.php:298
|
40 |
msgid "Previous Page Text:"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: wp-paginate.php:300
|
44 |
msgid "The text to display for the previous page link."
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: wp-paginate.php:303
|
48 |
msgid "Next Page Text:"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: wp-paginate.php:305
|
52 |
msgid "The text to display for the next page link."
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: wp-paginate.php:309
|
56 |
msgid "Advanced Settings"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: wp-paginate.php:312
|
60 |
msgid "Before Markup:"
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: wp-paginate.php:314
|
64 |
msgid "The HTML markup to display before the pagination code."
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: wp-paginate.php:317
|
68 |
msgid "After Markup:"
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: wp-paginate.php:319
|
72 |
msgid "The HTML markup to display after the pagination code."
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: wp-paginate.php:322
|
76 |
msgid "Markup Display:"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: wp-paginate.php:324
|
80 |
msgid "Always show Markup, even when the page list is empty?"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: wp-paginate.php:327
|
84 |
msgid "CSS File:"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: wp-paginate.php:329
|
88 |
msgid "Deselect this option to prevent loading wp-paginate.css."
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: wp-paginate.php:332
|
92 |
msgid "Page Range:"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: wp-paginate.php:339
|
96 |
msgid ""
|
97 |
"The number of page links to show before and after the current page. "
|
98 |
"Recommended value: 3"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: wp-paginate.php:342
|
102 |
msgid "Page Anchors:"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: wp-paginate.php:349
|
106 |
msgid ""
|
107 |
"The number of links to always show at beginning and end of pagination. "
|
108 |
"Recommended value: 1"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: wp-paginate.php:352
|
112 |
msgid "Page Gap:"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: wp-paginate.php:359
|
116 |
msgid ""
|
117 |
"The minimum number of pages in a gap before ellipses (...) are added. "
|
118 |
"Recommended value: 3"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: wp-paginate.php:366
|
122 |
msgid "Need Support?"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: wp-paginate.php:367
|
126 |
+
#, php-format
|
127 |
msgid ""
|
128 |
"For questions, issues or feature requests, please post them in the %s and "
|
129 |
"make sure to tag the post with wp-paginate."
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: wp-paginate.php:368
|
133 |
msgid "Like To Contribute?"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: wp-paginate.php:369
|
137 |
msgid ""
|
138 |
"If you would like to contribute, the following is a list of ways you can "
|
139 |
"help:"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: wp-paginate.php:371
|
143 |
msgid "Translate WP-Paginate into your language"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: wp-paginate.php:372
|
147 |
msgid "Blog about or link to WP-Paginate so others can find out about it"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: wp-paginate.php:373
|
151 |
msgid "Report issues, provide feedback, request features, etc."
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: wp-paginate.php:374
|
155 |
msgid "Rate WP-Paginate on the WordPress Plugins Page"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: wp-paginate.php:375
|
159 |
msgid "Make a donation"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: wp-paginate.php:377
|
163 |
msgid "Other Links"
|
164 |
msgstr ""
|
165 |
|
|
|
|
|
|
|
|
|
166 |
#. Description of an extension
|
167 |
+
msgid ""
|
168 |
+
"A simple and flexible pagination plugin for WordPress posts and comments."
|
169 |
msgstr ""
|
|
readme.txt
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
=== WP-Paginate ===
|
2 |
Contributors: emartin24
|
3 |
Donate link: http://www.ericmmartin.com/donate/
|
4 |
-
Tags: paginate, pagination, navigation, page, wp-paginate
|
5 |
-
Requires at least: 2.2.0
|
6 |
Tested up to: 2.8.4
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
-
WP-Paginate is a simple and flexible pagination plugin which provides users with better navigation
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
WP-Paginate is a simple and flexible pagination plugin which provides users with better navigation
|
14 |
|
15 |
-
In addition to increasing the
|
|
|
|
|
16 |
|
17 |
== Installation ==
|
18 |
|
@@ -24,14 +26,23 @@ In addition to increasing the usability for your visitors, it has also been wide
|
|
24 |
|
25 |
*Implement*
|
26 |
|
27 |
-
|
|
|
28 |
|
29 |
2) Replace your existing `previous_posts_link()` and `next_posts_link()` code block with the following:
|
30 |
|
31 |
-
<?php if(function_exists(
|
32 |
wp_paginate();
|
33 |
} ?>
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
*Configure*
|
37 |
|
@@ -49,7 +60,7 @@ In addition to increasing the usability for your visitors, it has also been wide
|
|
49 |
|
50 |
= How can I override the default pagination settings? =
|
51 |
|
52 |
-
The `wp_paginate()`
|
53 |
|
54 |
* title - The text to display before the pagination links
|
55 |
* nextpage - The text to use for the next page link
|
@@ -66,12 +77,37 @@ You can even control the current page and number of pages with:
|
|
66 |
* page - The current page. This function will automatically determine the value
|
67 |
* pages - The total number of pages. This function will automatically determine the value
|
68 |
|
69 |
-
Example:
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
} ?>
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
== Screenshots ==
|
77 |
|
@@ -80,6 +116,9 @@ Example:
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
83 |
= 1.0.1 =
|
84 |
* Added I18n folder and wp-paginate.pot file
|
85 |
* Fixed some internationalization and spelling errors
|
1 |
=== WP-Paginate ===
|
2 |
Contributors: emartin24
|
3 |
Donate link: http://www.ericmmartin.com/donate/
|
4 |
+
Tags: paginate, pagination, navigation, page, wp-paginate, comments
|
5 |
+
Requires at least: 2.2.0 (2.7.0 for comments pagination)
|
6 |
Tested up to: 2.8.4
|
7 |
+
Stable tag: 1.1
|
8 |
|
9 |
+
WP-Paginate is a simple and flexible pagination plugin which provides users with better navigation on your WordPress site.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
WP-Paginate is a simple and flexible pagination plugin which provides users with better navigation on your WordPress site.
|
14 |
|
15 |
+
In addition to increasing the user experience for your visitors, it has also been widely reported that pagination increases the SEO of your site by providing more links to your content.
|
16 |
+
|
17 |
+
Starting in version 1.1, WP-Paginate can be used to paginate posts as well as post comments!
|
18 |
|
19 |
== Installation ==
|
20 |
|
26 |
|
27 |
*Implement*
|
28 |
|
29 |
+
For posts pagination:
|
30 |
+
1) Open the theme files where you'd like pagination to be used. Usually this is the index.php, archive.php and search.php files.
|
31 |
|
32 |
2) Replace your existing `previous_posts_link()` and `next_posts_link()` code block with the following:
|
33 |
|
34 |
+
<?php if(function_exists('wp_paginate')) {
|
35 |
wp_paginate();
|
36 |
} ?>
|
37 |
|
38 |
+
For comments pagination:
|
39 |
+
1) Open the theme file(s) where you'd like comments pagination to be used. Usually this is the comments.php file.
|
40 |
+
|
41 |
+
2) Replace your existing `previous_comments_link()` and `next_comments_link()` code block with the following:
|
42 |
+
|
43 |
+
<?php if(function_exists('wp_paginate_comments')) {
|
44 |
+
wp_paginate_comments();
|
45 |
+
} ?>
|
46 |
|
47 |
*Configure*
|
48 |
|
60 |
|
61 |
= How can I override the default pagination settings? =
|
62 |
|
63 |
+
The `wp_paginate()` and `wp_paginate_comments()` functions each takes one optional argument, in query string format, which allows you to override the global settings. The available options are:
|
64 |
|
65 |
* title - The text to display before the pagination links
|
66 |
* nextpage - The text to use for the next page link
|
77 |
* page - The current page. This function will automatically determine the value
|
78 |
* pages - The total number of pages. This function will automatically determine the value
|
79 |
|
80 |
+
Example (also applies to `wp_paginate_comments()`):
|
81 |
+
|
82 |
+
<?php if(function_exists('wp_paginate')) {
|
83 |
+
wp_paginate('range=4&anchor=2&nextpage=Next&previouspage=Previous');
|
84 |
+
} ?>
|
85 |
+
|
86 |
+
= How can I style the comments pagination differently than the posts pagination? =
|
87 |
|
88 |
+
There are a number of ways to do this, but basically, you'll want to override the default styles.
|
89 |
+
|
90 |
+
For example, you could do the following:
|
91 |
+
|
92 |
+
1) Modify the `wp_paginate_comments()` call:
|
93 |
+
|
94 |
+
<?php if(function_exists('wp_paginate_comments')) {
|
95 |
+
wp_paginate_comments('before=<div class="wp-paginate-comments">');
|
96 |
} ?>
|
97 |
+
|
98 |
+
2) Add CSS to override the default element styles:
|
99 |
+
|
100 |
+
.wp-paginate-comments {}
|
101 |
+
.wp-paginate-comments ol {}
|
102 |
+
.wp-paginate-comments li {}
|
103 |
+
.wp-paginate-comments a {}
|
104 |
+
.wp-paginate-comments a:hover, .wp-paginate-comments a:active {}
|
105 |
+
.wp-paginate-comments .title {}
|
106 |
+
.wp-paginate-comments .gap {}
|
107 |
+
.wp-paginate-comments .current {}
|
108 |
+
.wp-paginate-comments .page {}
|
109 |
+
.wp-paginate-comments .prev, .wp-paginate .next {}
|
110 |
+
|
111 |
|
112 |
== Screenshots ==
|
113 |
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
+
= 1.1 =
|
120 |
+
* Added `wp_paginate_comments()` function for pagination of post comments
|
121 |
+
|
122 |
= 1.0.1 =
|
123 |
* Added I18n folder and wp-paginate.pot file
|
124 |
* Fixed some internationalization and spelling errors
|
wp-paginate.css
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*
|
2 |
* WP-Paginate - WordPress Pagination Function
|
3 |
-
* Revision: $Id$
|
4 |
-
* Copyright (c) 2009 Eric Martin http://www.ericmmartin.com/
|
5 |
*/
|
6 |
.wp-paginate {}
|
7 |
.wp-paginate ol {padding:0; margin:0;}
|
1 |
/*
|
2 |
* WP-Paginate - WordPress Pagination Function
|
3 |
+
* Revision: $Id: wp-paginate.css 153392 2009-09-09 23:28:27Z emartin24 $
|
4 |
+
* Copyright (c) 2009 Eric Martin http://www.ericmmartin.com/projects/wp-paginate/
|
5 |
*/
|
6 |
.wp-paginate {}
|
7 |
.wp-paginate ol {padding:0; margin:0;}
|
wp-paginate.php
CHANGED
@@ -2,10 +2,11 @@
|
|
2 |
/*
|
3 |
Plugin Name: WP-Paginate
|
4 |
Plugin URI: http://www.ericmmartin.com/projects/wp-paginate/
|
5 |
-
Description: A simple and flexible pagination plugin for WordPress.
|
6 |
Author: Eric Martin
|
7 |
-
Version: 1.
|
8 |
Author URI: http://www.ericmmartin.com
|
|
|
9 |
*/
|
10 |
|
11 |
/* Copyright 2009 Eric Martin (eric@ericmmartin.com)
|
@@ -26,9 +27,8 @@ Author URI: http://www.ericmmartin.com
|
|
26 |
*/
|
27 |
|
28 |
/**
|
29 |
-
* Set the wp-content and plugin urls/paths
|
30 |
-
*/
|
31 |
-
// Pre-2.6 compatibility
|
32 |
if (!defined('WP_CONTENT_URL'))
|
33 |
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
|
34 |
if (!defined('WP_CONTENT_DIR'))
|
@@ -40,22 +40,21 @@ if (!defined('WP_PLUGIN_DIR') )
|
|
40 |
|
41 |
if (!class_exists('WPPaginate')) {
|
42 |
class WPPaginate {
|
43 |
-
var $version = '1.
|
44 |
-
|
45 |
-
//This is where the class variables go, don't forget to use @var to tell what they're for
|
46 |
/**
|
47 |
-
|
48 |
-
|
49 |
var $optionsName = 'wp_paginate_options';
|
50 |
|
51 |
/**
|
52 |
-
|
53 |
-
|
54 |
-
var $localizationDomain =
|
55 |
|
56 |
/**
|
57 |
-
|
58 |
-
|
59 |
var $pluginurl = '';
|
60 |
/**
|
61 |
* @var string $pluginpath The path to this plugin
|
@@ -63,19 +62,20 @@ if (!class_exists('WPPaginate')) {
|
|
63 |
var $pluginpath = '';
|
64 |
|
65 |
/**
|
66 |
-
|
67 |
-
|
68 |
var $options = array();
|
|
|
|
|
69 |
|
70 |
-
//Class Functions
|
71 |
/**
|
72 |
-
|
73 |
-
|
74 |
function WPPaginate() {$this->__construct();}
|
75 |
|
76 |
/**
|
77 |
-
|
78 |
-
|
79 |
function __construct() {
|
80 |
$name = dirname(plugin_basename(__FILE__));
|
81 |
|
@@ -99,19 +99,35 @@ if (!class_exists('WPPaginate')) {
|
|
99 |
/**
|
100 |
* Pagination based on options/args
|
101 |
*/
|
102 |
-
function paginate($args = false) {
|
|
|
|
|
|
|
103 |
$r = wp_parse_args($args, $this->options);
|
104 |
extract($r, EXTR_SKIP);
|
105 |
|
106 |
if (!isset($page) && !isset($pages)) {
|
107 |
global $wp_query;
|
108 |
-
|
109 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
$page = !empty($page) ? intval($page) : 1;
|
111 |
-
|
112 |
-
$posts_per_page = intval(get_query_var('posts_per_page'));
|
113 |
-
$pages = intval(ceil($wp_query->found_posts / $posts_per_page));
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
$output = stripslashes($before);
|
117 |
if ($pages > 1) {
|
@@ -119,7 +135,7 @@ if (!class_exists('WPPaginate')) {
|
|
119 |
$ellipsis = "<li><span class='gap'>...</span></li>";
|
120 |
|
121 |
if ($page > 1 && !empty($previouspage)) {
|
122 |
-
$output .= "<li><a href='
|
123 |
}
|
124 |
|
125 |
$min_links = $range * 2 + 1;
|
@@ -156,7 +172,7 @@ if (!class_exists('WPPaginate')) {
|
|
156 |
}
|
157 |
|
158 |
if ($page < $pages && !empty($nextpage)) {
|
159 |
-
$output .= "<li><a href='
|
160 |
}
|
161 |
$output .= "</ol>";
|
162 |
}
|
@@ -173,7 +189,7 @@ if (!class_exists('WPPaginate')) {
|
|
173 |
function paginate_loop($start, $max, $page = 0) {
|
174 |
$output = "";
|
175 |
for ($i = $start; $i <= $max; $i++) {
|
176 |
-
$p = get_pagenum_link($i);
|
177 |
$output .= ($page == intval($i))
|
178 |
? "<li><span class='page current'>$i</span></li>"
|
179 |
: "<li><a href='$p' title='$i' class='page'>$i</a></li>";
|
@@ -194,9 +210,9 @@ if (!class_exists('WPPaginate')) {
|
|
194 |
}
|
195 |
|
196 |
/**
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
function get_options() {
|
201 |
if (!$options = get_option($this->optionsName)) {
|
202 |
$options = array(
|
@@ -216,23 +232,23 @@ if (!class_exists('WPPaginate')) {
|
|
216 |
$this->options = $options;
|
217 |
}
|
218 |
/**
|
219 |
-
|
220 |
-
|
221 |
function save_admin_options(){
|
222 |
return update_option($this->optionsName, $this->options);
|
223 |
}
|
224 |
|
225 |
/**
|
226 |
-
|
227 |
-
|
228 |
function admin_menu_link() {
|
229 |
add_options_page('WP-Paginate', 'WP-Paginate', 10, basename(__FILE__), array(&$this, 'admin_options_page'));
|
230 |
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'filter_plugin_actions'), 10, 2 );
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
-
|
235 |
-
|
236 |
function filter_plugin_actions($links, $file) {
|
237 |
$settings_link = '<a href="options-general.php?page=' . basename(__FILE__) . '">' . __('Settings', $this->localizationDomain) . '</a>';
|
238 |
array_unshift($links, $settings_link); // before other links
|
@@ -241,8 +257,8 @@ if (!class_exists('WPPaginate')) {
|
|
241 |
}
|
242 |
|
243 |
/**
|
244 |
-
|
245 |
-
|
246 |
function admin_options_page() {
|
247 |
if (isset($_POST['wp_paginate_save'])) {
|
248 |
if (wp_verify_nonce($_POST['_wpnonce'], 'wp-paginate-update-options')) {
|
@@ -376,10 +392,25 @@ if (class_exists('WPPaginate')) {
|
|
376 |
$wp_paginate = new WPPaginate();
|
377 |
}
|
378 |
|
|
|
|
|
|
|
379 |
function wp_paginate($args = false) {
|
380 |
global $wp_paginate;
|
381 |
return $wp_paginate->paginate($args);
|
382 |
}
|
383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
|
|
|
|
|
|
|
|
|
385 |
?>
|
2 |
/*
|
3 |
Plugin Name: WP-Paginate
|
4 |
Plugin URI: http://www.ericmmartin.com/projects/wp-paginate/
|
5 |
+
Description: A simple and flexible pagination plugin for WordPress posts and comments.
|
6 |
Author: Eric Martin
|
7 |
+
Version: 1.1
|
8 |
Author URI: http://www.ericmmartin.com
|
9 |
+
Revision: $Id: wp-paginate.php 153392 2009-09-09 23:28:27Z emartin24 $
|
10 |
*/
|
11 |
|
12 |
/* Copyright 2009 Eric Martin (eric@ericmmartin.com)
|
27 |
*/
|
28 |
|
29 |
/**
|
30 |
+
* Set the wp-content and plugin urls/paths
|
31 |
+
*/
|
|
|
32 |
if (!defined('WP_CONTENT_URL'))
|
33 |
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
|
34 |
if (!defined('WP_CONTENT_DIR'))
|
40 |
|
41 |
if (!class_exists('WPPaginate')) {
|
42 |
class WPPaginate {
|
43 |
+
var $version = '1.1';
|
44 |
+
|
|
|
45 |
/**
|
46 |
+
* @var string The options string name for this plugin
|
47 |
+
*/
|
48 |
var $optionsName = 'wp_paginate_options';
|
49 |
|
50 |
/**
|
51 |
+
* @var string $localizationDomain Domain used for localization
|
52 |
+
*/
|
53 |
+
var $localizationDomain = 'wp_paginate';
|
54 |
|
55 |
/**
|
56 |
+
* @var string $pluginurl The url to this plugin
|
57 |
+
*/
|
58 |
var $pluginurl = '';
|
59 |
/**
|
60 |
* @var string $pluginpath The path to this plugin
|
62 |
var $pluginpath = '';
|
63 |
|
64 |
/**
|
65 |
+
* @var array $options Stores the options for this plugin
|
66 |
+
*/
|
67 |
var $options = array();
|
68 |
+
|
69 |
+
var $type = 'posts';
|
70 |
|
|
|
71 |
/**
|
72 |
+
* PHP 4 Compatible Constructor
|
73 |
+
*/
|
74 |
function WPPaginate() {$this->__construct();}
|
75 |
|
76 |
/**
|
77 |
+
* PHP 5 Constructor
|
78 |
+
*/
|
79 |
function __construct() {
|
80 |
$name = dirname(plugin_basename(__FILE__));
|
81 |
|
99 |
/**
|
100 |
* Pagination based on options/args
|
101 |
*/
|
102 |
+
function paginate($args = false) {
|
103 |
+
if ($this->type === 'comments' && !get_option('page_comments'))
|
104 |
+
return;
|
105 |
+
|
106 |
$r = wp_parse_args($args, $this->options);
|
107 |
extract($r, EXTR_SKIP);
|
108 |
|
109 |
if (!isset($page) && !isset($pages)) {
|
110 |
global $wp_query;
|
111 |
+
|
112 |
+
if ($this->type === 'posts') {
|
113 |
+
$page = get_query_var('paged');
|
114 |
+
$posts_per_page = intval(get_query_var('posts_per_page'));
|
115 |
+
$pages = intval(ceil($wp_query->found_posts / $posts_per_page));
|
116 |
+
}
|
117 |
+
else {
|
118 |
+
$page = get_query_var('cpage');
|
119 |
+
$posts_per_page = get_option('comments_per_page');
|
120 |
+
$pages = intval(ceil($wp_query->comment_count / $posts_per_page));
|
121 |
+
}
|
122 |
$page = !empty($page) ? intval($page) : 1;
|
|
|
|
|
|
|
123 |
}
|
124 |
+
|
125 |
+
$prevlink = ($this->type === 'posts')
|
126 |
+
? get_pagenum_link($page - 1)
|
127 |
+
: get_comments_pagenum_link($page - 1);
|
128 |
+
$nextlink = ($this->type === 'posts')
|
129 |
+
? get_pagenum_link($page + 1)
|
130 |
+
: get_comments_pagenum_link($page + 1);
|
131 |
|
132 |
$output = stripslashes($before);
|
133 |
if ($pages > 1) {
|
135 |
$ellipsis = "<li><span class='gap'>...</span></li>";
|
136 |
|
137 |
if ($page > 1 && !empty($previouspage)) {
|
138 |
+
$output .= "<li><a href='$prevlink' class='prev'>$previouspage</a></li>";
|
139 |
}
|
140 |
|
141 |
$min_links = $range * 2 + 1;
|
172 |
}
|
173 |
|
174 |
if ($page < $pages && !empty($nextpage)) {
|
175 |
+
$output .= "<li><a href='$nextlink' class='next'>$nextpage</a></li>";
|
176 |
}
|
177 |
$output .= "</ol>";
|
178 |
}
|
189 |
function paginate_loop($start, $max, $page = 0) {
|
190 |
$output = "";
|
191 |
for ($i = $start; $i <= $max; $i++) {
|
192 |
+
$p = ($this->type === 'posts') ? get_pagenum_link($i) : get_comments_pagenum_link($i);
|
193 |
$output .= ($page == intval($i))
|
194 |
? "<li><span class='page current'>$i</span></li>"
|
195 |
: "<li><a href='$p' title='$i' class='page'>$i</a></li>";
|
210 |
}
|
211 |
|
212 |
/**
|
213 |
+
* Retrieves the plugin options from the database.
|
214 |
+
* @return array
|
215 |
+
*/
|
216 |
function get_options() {
|
217 |
if (!$options = get_option($this->optionsName)) {
|
218 |
$options = array(
|
232 |
$this->options = $options;
|
233 |
}
|
234 |
/**
|
235 |
+
* Saves the admin options to the database.
|
236 |
+
*/
|
237 |
function save_admin_options(){
|
238 |
return update_option($this->optionsName, $this->options);
|
239 |
}
|
240 |
|
241 |
/**
|
242 |
+
* @desc Adds the options subpanel
|
243 |
+
*/
|
244 |
function admin_menu_link() {
|
245 |
add_options_page('WP-Paginate', 'WP-Paginate', 10, basename(__FILE__), array(&$this, 'admin_options_page'));
|
246 |
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'filter_plugin_actions'), 10, 2 );
|
247 |
}
|
248 |
|
249 |
/**
|
250 |
+
* @desc Adds the Settings link to the plugin activate/deactivate page
|
251 |
+
*/
|
252 |
function filter_plugin_actions($links, $file) {
|
253 |
$settings_link = '<a href="options-general.php?page=' . basename(__FILE__) . '">' . __('Settings', $this->localizationDomain) . '</a>';
|
254 |
array_unshift($links, $settings_link); // before other links
|
257 |
}
|
258 |
|
259 |
/**
|
260 |
+
* Adds settings/options page
|
261 |
+
*/
|
262 |
function admin_options_page() {
|
263 |
if (isset($_POST['wp_paginate_save'])) {
|
264 |
if (wp_verify_nonce($_POST['_wpnonce'], 'wp-paginate-update-options')) {
|
392 |
$wp_paginate = new WPPaginate();
|
393 |
}
|
394 |
|
395 |
+
/**
|
396 |
+
* Pagination function to use for posts
|
397 |
+
*/
|
398 |
function wp_paginate($args = false) {
|
399 |
global $wp_paginate;
|
400 |
return $wp_paginate->paginate($args);
|
401 |
}
|
402 |
|
403 |
+
/**
|
404 |
+
* Pagination function to use for post comments
|
405 |
+
*/
|
406 |
+
function wp_paginate_comments($args = false) {
|
407 |
+
global $wp_paginate;
|
408 |
+
$wp_paginate->type = 'comments';
|
409 |
+
return $wp_paginate->paginate($args);
|
410 |
+
}
|
411 |
|
412 |
+
/*
|
413 |
+
* The format of this plugin is based on the following plugin template:
|
414 |
+
* http://pressography.com/plugins/wordpress-plugin-template/
|
415 |
+
*/
|
416 |
?>
|