WP Page Numbers - Version 0.5

Version Description

Download this release

Release Info

Developer Jenst
Plugin Icon wp plugin WP Page Numbers
Version 0.5
Comparing to
See all releases

Code changes from version 0.4 to 0.5

Files changed (2) hide show
  1. readme.txt +4 -1
  2. wp-page-numbers.php +90 -93
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: navigation, paging, page, numbers, archive, categories, plugin, seo
3
  Requires at least: 2.3
4
  Tested up to: 2.8
5
- Stable tag: 0.4
6
 
7
  A simple paging navigation plugin for users and search engines. Instead of next and previous page it shows numbers and arrows. Settings available.
8
 
@@ -11,6 +11,9 @@ A simple paging navigation plugin for users and search engines. Instead of next
11
  = User friendly navigation =
12
  With page numbers instead of next and previous links users can easily navigate much quicker to the page they want. It is good for SEO (Search Engine Optimization) as well, because it creates a tighter inner link structure. Works with all well known browsers (Internet Explorer, Firefox, Opera and Safari).
13
 
 
 
 
14
  = Updates 0.4 =
15
  * Added optional start and end code link wp_page_numbers($start, $end)
16
  * Changed get_bloginfo(url) to get_bloginfo(wpurl)
2
  Tags: navigation, paging, page, numbers, archive, categories, plugin, seo
3
  Requires at least: 2.3
4
  Tested up to: 2.8
5
+ Stable tag: 0.5
6
 
7
  A simple paging navigation plugin for users and search engines. Instead of next and previous page it shows numbers and arrows. Settings available.
8
 
11
  = User friendly navigation =
12
  With page numbers instead of next and previous links users can easily navigate much quicker to the page they want. It is good for SEO (Search Engine Optimization) as well, because it creates a tighter inner link structure. Works with all well known browsers (Internet Explorer, Firefox, Opera and Safari).
13
 
14
+ = Updates 0.5 =
15
+ * Fixed bug with page numbers disappearing
16
+
17
  = Updates 0.4 =
18
  * Added optional start and end code link wp_page_numbers($start, $end)
19
  * Changed get_bloginfo(url) to get_bloginfo(wpurl)
wp-page-numbers.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Page Numbers
4
  Plugin URI: http://www.jenst.se/2008/03/29/wp-page-numbers
5
  Description: Show pages numbers instead of "Next page" and "Previous Page".
6
- Version: 0.4
7
  Author: Jens Törnell
8
  Author URI: http://www.jenst.se
9
  */
@@ -158,103 +158,100 @@ function wp_page_numbers_nextpage($paged, $max_page, $nextpage)
158
 
159
  function wp_page_numbers($start = "", $end = "")
160
  {
161
- if(is_front_page() || is_archive())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  {
163
- global $wp_query;
164
- global $max_page;
165
- global $paged;
166
- if ( !$max_page ) { $max_page = $wp_query->max_num_pages; }
167
- if ( !$paged ) { $paged = 1; }
168
-
169
- $settings = get_option('wp_page_numbers_array');
170
- $page_of_page = $settings["page_of_page"];
171
- $page_of_page_text = $settings["page_of_page_text"];
172
- $page_of_of = $settings["page_of_of"];
173
-
174
- $next_prev_text = $settings["next_prev_text"];
175
- $show_start_end_numbers = $settings["show_start_end_numbers"];
176
- $show_page_numbers = $settings["show_page_numbers"];
177
-
178
- $limit_pages = $settings["limit_pages"];
179
- $nextpage = $settings["nextpage"];
180
- $prevpage = $settings["prevpage"];
181
- $startspace = $settings["startspace"];
182
- $endspace = $settings["endspace"];
183
-
184
- if( $nextpage == "" ) { $nextpage = ">"; }
185
- if( $prevpage == "" ) { $prevpage = "<"; }
186
- if( $startspace == "" ) { $startspace = "..."; }
187
- if( $endspace == "" ) { $endspace = "..."; }
188
-
189
- if($limit_pages == "") { $limit_pages = "10"; }
190
- elseif ( $limit_pages == "0" ) { $limit_pages = $max_page; }
191
-
192
- if(wp_page_numbers_check_num($limit_pages) == true)
193
- {
194
- $limit_pages_left = ($limit_pages-1)/2;
195
- $limit_pages_right = ($limit_pages-1)/2;
196
- }
197
- else
198
- {
199
- $limit_pages_left = $limit_pages/2;
200
- $limit_pages_right = ($limit_pages/2)-1;
201
- }
202
-
203
- if( $max_page <= $limit_pages ) { $limit_pages = $max_page; }
204
-
205
- $pagingString = "<div id='wp_page_numbers'>\n";
206
- $pagingString .= '<ul>';
207
-
208
- if($page_of_page != "no")
209
- $pagingString .= wp_page_numbers_page_of_page($max_page, $paged, $page_of_page_text, $page_of_of);
210
-
211
- if( ($paged) <= $limit_pages_left )
212
- {
213
- list ($value1, $value2, $page_check_min) = wp_page_numbers_left_side($max_page, $limit_pages, $paged, $pagingString);
214
- $pagingMiddleString .= $value1;
215
- }
216
- elseif( ($max_page+1 - $paged) <= $limit_pages_right )
217
  {
218
- list ($value1, $value2, $page_check_min) = wp_page_numbers_right_side($max_page, $limit_pages, $paged, $pagingString);
219
- $pagingMiddleString .= $value1;
 
220
  }
221
- else
 
 
 
 
222
  {
223
- list ($value1, $value2, $page_check_min) = wp_page_numbers_middle_side($max_page, $paged, $limit_pages_left, $limit_pages_right);
224
- $pagingMiddleString .= $value1;
 
 
225
  }
226
- if($next_prev_text != "no")
227
- $pagingString .= wp_page_numbers_prevpage($paged, $max_page, $prevpage);
228
-
229
- if ($page_check_min == false && $show_start_end_numbers != "no")
230
- {
231
- $pagingString .= "<li class=\"first_last_page\">";
232
- $pagingString .= "<a href=\"" . get_pagenum_link(1) . "\">1</a>";
233
- $pagingString .= "</li>\n<li class=\"space\">".$startspace."</li>\n";
234
- }
235
-
236
- if($show_page_numbers != "no")
237
- $pagingString .= $pagingMiddleString;
238
-
239
- if ($value2 == false && $show_start_end_numbers != "no")
240
- {
241
- $pagingString .= "<li class=\"space\">".$endspace."</li>\n";
242
- $pagingString .= "<li class=\"first_last_page\">";
243
- $pagingString .= "<a href=\"" . get_pagenum_link($max_page) . "\">" . $max_page . "</a>";
244
- $pagingString .= "</li>\n";
245
- }
246
-
247
- if($next_prev_text != "no")
248
- $pagingString .= wp_page_numbers_nextpage($paged, $max_page, $nextpage);
249
-
250
- $pagingString .= "</ul>\n";
251
-
252
- $pagingString .= "<div style='float: none; clear: both;'></div>\n";
253
- $pagingString .= "</div>\n";
254
-
255
- if($max_page != 1)
256
- echo $start . $pagingString . $end;
257
- }
258
  }
259
 
260
  function wp_page_numbers_settings()
3
  Plugin Name: WP Page Numbers
4
  Plugin URI: http://www.jenst.se/2008/03/29/wp-page-numbers
5
  Description: Show pages numbers instead of "Next page" and "Previous Page".
6
+ Version: 0.5
7
  Author: Jens T&ouml;rnell
8
  Author URI: http://www.jenst.se
9
  */
158
 
159
  function wp_page_numbers($start = "", $end = "")
160
  {
161
+ global $wp_query;
162
+ global $max_page;
163
+ global $paged;
164
+ if ( !$max_page ) { $max_page = $wp_query->max_num_pages; }
165
+ if ( !$paged ) { $paged = 1; }
166
+
167
+ $settings = get_option('wp_page_numbers_array');
168
+ $page_of_page = $settings["page_of_page"];
169
+ $page_of_page_text = $settings["page_of_page_text"];
170
+ $page_of_of = $settings["page_of_of"];
171
+
172
+ $next_prev_text = $settings["next_prev_text"];
173
+ $show_start_end_numbers = $settings["show_start_end_numbers"];
174
+ $show_page_numbers = $settings["show_page_numbers"];
175
+
176
+ $limit_pages = $settings["limit_pages"];
177
+ $nextpage = $settings["nextpage"];
178
+ $prevpage = $settings["prevpage"];
179
+ $startspace = $settings["startspace"];
180
+ $endspace = $settings["endspace"];
181
+
182
+ if( $nextpage == "" ) { $nextpage = "&gt;"; }
183
+ if( $prevpage == "" ) { $prevpage = "&lt;"; }
184
+ if( $startspace == "" ) { $startspace = "..."; }
185
+ if( $endspace == "" ) { $endspace = "..."; }
186
+
187
+ if($limit_pages == "") { $limit_pages = "10"; }
188
+ elseif ( $limit_pages == "0" ) { $limit_pages = $max_page; }
189
+
190
+ if(wp_page_numbers_check_num($limit_pages) == true)
191
  {
192
+ $limit_pages_left = ($limit_pages-1)/2;
193
+ $limit_pages_right = ($limit_pages-1)/2;
194
+ }
195
+ else
196
+ {
197
+ $limit_pages_left = $limit_pages/2;
198
+ $limit_pages_right = ($limit_pages/2)-1;
199
+ }
200
+
201
+ if( $max_page <= $limit_pages ) { $limit_pages = $max_page; }
202
+
203
+ $pagingString = "<div id='wp_page_numbers'>\n";
204
+ $pagingString .= '<ul>';
205
+
206
+ if($page_of_page != "no")
207
+ $pagingString .= wp_page_numbers_page_of_page($max_page, $paged, $page_of_page_text, $page_of_of);
208
+
209
+ if( ($paged) <= $limit_pages_left )
210
+ {
211
+ list ($value1, $value2, $page_check_min) = wp_page_numbers_left_side($max_page, $limit_pages, $paged, $pagingString);
212
+ $pagingMiddleString .= $value1;
213
+ }
214
+ elseif( ($max_page+1 - $paged) <= $limit_pages_right )
215
+ {
216
+ list ($value1, $value2, $page_check_min) = wp_page_numbers_right_side($max_page, $limit_pages, $paged, $pagingString);
217
+ $pagingMiddleString .= $value1;
218
+ }
219
+ else
220
+ {
221
+ list ($value1, $value2, $page_check_min) = wp_page_numbers_middle_side($max_page, $paged, $limit_pages_left, $limit_pages_right);
222
+ $pagingMiddleString .= $value1;
223
+ }
224
+ if($next_prev_text != "no")
225
+ $pagingString .= wp_page_numbers_prevpage($paged, $max_page, $prevpage);
226
+
227
+ if ($page_check_min == false && $show_start_end_numbers != "no")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  {
229
+ $pagingString .= "<li class=\"first_last_page\">";
230
+ $pagingString .= "<a href=\"" . get_pagenum_link(1) . "\">1</a>";
231
+ $pagingString .= "</li>\n<li class=\"space\">".$startspace."</li>\n";
232
  }
233
+
234
+ if($show_page_numbers != "no")
235
+ $pagingString .= $pagingMiddleString;
236
+
237
+ if ($value2 == false && $show_start_end_numbers != "no")
238
  {
239
+ $pagingString .= "<li class=\"space\">".$endspace."</li>\n";
240
+ $pagingString .= "<li class=\"first_last_page\">";
241
+ $pagingString .= "<a href=\"" . get_pagenum_link($max_page) . "\">" . $max_page . "</a>";
242
+ $pagingString .= "</li>\n";
243
  }
244
+
245
+ if($next_prev_text != "no")
246
+ $pagingString .= wp_page_numbers_nextpage($paged, $max_page, $nextpage);
247
+
248
+ $pagingString .= "</ul>\n";
249
+
250
+ $pagingString .= "<div style='float: none; clear: both;'></div>\n";
251
+ $pagingString .= "</div>\n";
252
+
253
+ if($max_page > 1)
254
+ echo $start . $pagingString . $end;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  }
256
 
257
  function wp_page_numbers_settings()