Version Description
Download this release
Release Info
Developer | Jenst |
Plugin | WP Page Numbers |
Version | 0.4 |
Comparing to | |
See all releases |
Code changes from version 0.3 to 0.4
- readme.txt +5 -1
- wp-page-numbers.php +120 -102
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.
|
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,10 @@ 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.3 =
|
15 |
* Changed get_settings (deprecated) to get_bloginfo (bugfix)
|
16 |
* Added missing echos, which should fix the URLs to the preview images in admin
|
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 |
= 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)
|
17 |
+
|
18 |
= Updates 0.3 =
|
19 |
* Changed get_settings (deprecated) to get_bloginfo (bugfix)
|
20 |
* Added missing echos, which should fix the URLs to the preview images in admin
|
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.
|
7 |
Author: Jens Törnell
|
8 |
Author URI: http://www.jenst.se
|
9 |
*/
|
@@ -17,7 +17,7 @@ function wp_page_numbers_stylesheet()
|
|
17 |
|
18 |
if($head_stylesheet == "on" || $head_stylesheet == "" && (is_archive() || is_search() || is_home() ||is_page()))
|
19 |
{
|
20 |
-
echo '<link rel="stylesheet" href="'. get_bloginfo('
|
21 |
if($head_stylesheet_folder_name == "")
|
22 |
{
|
23 |
if($style_theme == "default")
|
@@ -156,106 +156,104 @@ function wp_page_numbers_nextpage($paged, $max_page, $nextpage)
|
|
156 |
return $pagingString;
|
157 |
}
|
158 |
|
159 |
-
function wp_page_numbers()
|
160 |
{
|
161 |
-
|
162 |
-
if(is_front_page() || is_archive())
|
163 |
-
{
|
164 |
-
global $wp_query;
|
165 |
-
global $max_page;
|
166 |
-
global $paged;
|
167 |
-
if ( !$max_page ) { $max_page = $wp_query->max_num_pages; }
|
168 |
-
if ( !$paged ) { $paged = 1; }
|
169 |
-
|
170 |
-
$settings = get_option('wp_page_numbers_array');
|
171 |
-
$page_of_page = $settings["page_of_page"];
|
172 |
-
$page_of_page_text = $settings["page_of_page_text"];
|
173 |
-
$page_of_of = $settings["page_of_of"];
|
174 |
-
|
175 |
-
$next_prev_text = $settings["next_prev_text"];
|
176 |
-
$show_start_end_numbers = $settings["show_start_end_numbers"];
|
177 |
-
$show_page_numbers = $settings["show_page_numbers"];
|
178 |
-
|
179 |
-
$limit_pages = $settings["limit_pages"];
|
180 |
-
$nextpage = $settings["nextpage"];
|
181 |
-
$prevpage = $settings["prevpage"];
|
182 |
-
$startspace = $settings["startspace"];
|
183 |
-
$endspace = $settings["endspace"];
|
184 |
-
|
185 |
-
if( $nextpage == "" ) { $nextpage = ">"; }
|
186 |
-
if( $prevpage == "" ) { $prevpage = "<"; }
|
187 |
-
if( $startspace == "" ) { $startspace = "..."; }
|
188 |
-
if( $endspace == "" ) { $endspace = "..."; }
|
189 |
-
|
190 |
-
if($limit_pages == "") { $limit_pages = "10"; }
|
191 |
-
elseif ( $limit_pages == "0" ) { $limit_pages = $max_page; }
|
192 |
-
|
193 |
-
if(wp_page_numbers_check_num($limit_pages) == true)
|
194 |
{
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
$
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
$
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
$pagingMiddleString .= $value1;
|
226 |
-
}
|
227 |
-
if($next_prev_text != "no")
|
228 |
-
$pagingString .= wp_page_numbers_prevpage($paged, $max_page, $prevpage);
|
229 |
-
|
230 |
-
if ($page_check_min == false && $show_start_end_numbers != "no")
|
231 |
{
|
232 |
-
$
|
233 |
-
$
|
234 |
-
$pagingString .= "</li>\n<li class=\"space\">".$startspace."</li>\n";
|
235 |
}
|
236 |
-
|
237 |
-
if($show_page_numbers != "no")
|
238 |
-
$pagingString .= $pagingMiddleString;
|
239 |
-
|
240 |
-
if ($value2 == false && $show_start_end_numbers != "no")
|
241 |
{
|
242 |
-
$
|
243 |
-
$
|
244 |
-
$pagingString .= "<a href=\"" . get_pagenum_link($max_page) . "\">" . $max_page . "</a>";
|
245 |
-
$pagingString .= "</li>\n";
|
246 |
}
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
}
|
261 |
|
@@ -344,7 +342,7 @@ function wp_page_numbers_settings()
|
|
344 |
echo 'checked="checked"';
|
345 |
}
|
346 |
?>/>
|
347 |
-
<img src="<?php echo get_bloginfo('
|
348 |
</td>
|
349 |
</tr>
|
350 |
<tr>
|
@@ -356,7 +354,7 @@ function wp_page_numbers_settings()
|
|
356 |
echo 'checked="checked"';
|
357 |
}
|
358 |
?>/>
|
359 |
-
<img src="<?php echo get_bloginfo('
|
360 |
</td>
|
361 |
</tr>
|
362 |
<tr>
|
@@ -368,7 +366,7 @@ function wp_page_numbers_settings()
|
|
368 |
echo 'checked="checked"';
|
369 |
}
|
370 |
?>/>
|
371 |
-
<img src="<?php echo get_bloginfo('
|
372 |
</td>
|
373 |
</tr>
|
374 |
<tr>
|
@@ -380,7 +378,7 @@ function wp_page_numbers_settings()
|
|
380 |
echo 'checked="checked"';
|
381 |
}
|
382 |
?>/>
|
383 |
-
<img src="<?php echo get_bloginfo('
|
384 |
</td>
|
385 |
</tr>
|
386 |
<tr>
|
@@ -392,7 +390,7 @@ function wp_page_numbers_settings()
|
|
392 |
echo 'checked="checked"';
|
393 |
}
|
394 |
?>/>
|
395 |
-
<img src="<?php echo get_bloginfo('
|
396 |
</td>
|
397 |
</tr>
|
398 |
<tr>
|
@@ -406,7 +404,7 @@ function wp_page_numbers_settings()
|
|
406 |
<td></td>
|
407 |
<td colspan="2">
|
408 |
- Have you create a cool WP Page Numbers theme?<br />
|
409 |
-
- Want to share it to the rest of the world? <a href="http://www.jenst.se/
|
410 |
</td>
|
411 |
</tr>
|
412 |
</table>
|
@@ -527,7 +525,27 @@ function wp_page_numbers_settings()
|
|
527 |
</div>
|
528 |
|
529 |
<div class="wrap">
|
530 |
-
<h2>Instructions</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
<p>Most of the settings are already set to a default value if blank.</p>
|
532 |
<table>
|
533 |
<tr>
|
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 |
*/
|
17 |
|
18 |
if($head_stylesheet == "on" || $head_stylesheet == "" && (is_archive() || is_search() || is_home() ||is_page()))
|
19 |
{
|
20 |
+
echo '<link rel="stylesheet" href="'. get_bloginfo('wpurl') . '/wp-content/plugins/wp-page-numbers/';
|
21 |
if($head_stylesheet_folder_name == "")
|
22 |
{
|
23 |
if($style_theme == "default")
|
156 |
return $pagingString;
|
157 |
}
|
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 |
|
342 |
echo 'checked="checked"';
|
343 |
}
|
344 |
?>/>
|
345 |
+
<img src="<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/wp-page-numbers/default/preview.gif" alt="" />
|
346 |
</td>
|
347 |
</tr>
|
348 |
<tr>
|
354 |
echo 'checked="checked"';
|
355 |
}
|
356 |
?>/>
|
357 |
+
<img src="<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/wp-page-numbers/classic/preview.gif" alt="" />
|
358 |
</td>
|
359 |
</tr>
|
360 |
<tr>
|
366 |
echo 'checked="checked"';
|
367 |
}
|
368 |
?>/>
|
369 |
+
<img src="<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/wp-page-numbers/tiny/preview.gif" alt="" />
|
370 |
</td>
|
371 |
</tr>
|
372 |
<tr>
|
378 |
echo 'checked="checked"';
|
379 |
}
|
380 |
?>/>
|
381 |
+
<img src="<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/wp-page-numbers/panther/preview.gif" alt="" />
|
382 |
</td>
|
383 |
</tr>
|
384 |
<tr>
|
390 |
echo 'checked="checked"';
|
391 |
}
|
392 |
?>/>
|
393 |
+
<img src="<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/wp-page-numbers/stylish/preview.gif" alt="" />
|
394 |
</td>
|
395 |
</tr>
|
396 |
<tr>
|
404 |
<td></td>
|
405 |
<td colspan="2">
|
406 |
- Have you create a cool WP Page Numbers theme?<br />
|
407 |
+
- Want to share it to the rest of the world? <a href="http://www.jenst.se/2008/03/29/wp-page-numbers/">Write a comment about it</a>.
|
408 |
</td>
|
409 |
</tr>
|
410 |
</table>
|
525 |
</div>
|
526 |
|
527 |
<div class="wrap">
|
528 |
+
<h2>Instructions - Code to add to your theme</h2>
|
529 |
+
<p>Add the code where you find <code>previous_post()</code> and <code>next_post()</code> functions. If you can't find these tags, place the code between <code>endwhile;</code> and <code>endif;</code> in the_loop.</p>
|
530 |
+
<table>
|
531 |
+
<tr>
|
532 |
+
<td><strong>Code to add in your theme</strong></td>
|
533 |
+
</tr>
|
534 |
+
<tr>
|
535 |
+
<td colspan="2"><code><?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?></code><br /><br /></td>
|
536 |
+
</tr>
|
537 |
+
<tr>
|
538 |
+
<td><strong>Advanced (optional) settings</strong><br /><br /></td>
|
539 |
+
</tr>
|
540 |
+
<tr>
|
541 |
+
<td style="width: 400px;"><strong>Syntax:</strong> <code>wp_page_numbers($start, $end);</code></td>
|
542 |
+
<td><strong>Example:</strong> <code>wp_page_numbers("<div class='start'>", "</div>");</code></td>
|
543 |
+
</tr>
|
544 |
+
</table>
|
545 |
+
</div>
|
546 |
+
|
547 |
+
<div class="wrap">
|
548 |
+
<h2>Instructions - Settings</h2>
|
549 |
<p>Most of the settings are already set to a default value if blank.</p>
|
550 |
<table>
|
551 |
<tr>
|