Version Description
- Change post search ORDER BY from 'post_date' to 'ID'
- Add filter 'c2c_admin_post_navigation_orderby' for customizing search ORDER BY field
- Add filter 'c2c_admin_post_navigation_post_statuses' for customizing valid post_statuses for search
- Deprecate (but still support) 'admin_post_nav' filter
- Add filter 'c2c_admin_post_navigation_display' filter as replacement to 'admin_post_nav' filter to allow modifying output
- Retrieve post title via get_the_title() rather than directly from object
- Also strip tags from the title prior to use in tag attribute
- Don't navigate to auto-saves
- Check for is_admin() before defining class rather than during constructor
- esc_sql() on SQL strings that have potentially been filtered
- Use esc_attr() instead of attribute_escape()
- Store plugin instance in global variable, $c2c_admin_post_navigation, to allow for external manipulation
- Fix localization of the two strings
- Instantiate object within primary class_exists() check
- Note compatibility with WP 3.0+
- Drop compatibility with version of WP older than 2.8
- Minor code reformatting (spacing)
- Remove docs from top of plugin file (all that and more are in readme.txt)
- Remove trailing whitespace in header docs
- Add Upgrade Notice and Filters sections to readme.txt
- Add package info to top of plugin file
Download this release
Release Info
Developer | coffee2code |
Plugin | Admin Post Navigation |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.5
- admin-post-navigation.php +58 -62
- readme.txt +89 -4
admin-post-navigation.php
CHANGED
@@ -2,44 +2,30 @@
|
|
2 |
/**
|
3 |
* @package Admin_Post_Navigation
|
4 |
* @author Scott Reilly
|
5 |
-
* @version 1.
|
6 |
*/
|
7 |
/*
|
8 |
Plugin Name: Admin Post Navigation
|
9 |
-
Version: 1.
|
10 |
-
Plugin URI: http://coffee2code.com/wp-plugins/admin-post-navigation
|
11 |
Author: Scott Reilly
|
12 |
Author URI: http://coffee2code.com
|
13 |
Description: Adds links to the next and previous posts when editing a post in the WordPress admin.
|
14 |
|
15 |
-
|
16 |
-
present, respectively. The link titles (visible when hovering over the links) reveal the title of the previous/next
|
17 |
-
post. The links link to the "Edit Post" admin page for the previous/next posts so that you may edit them.
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
NOTE: Be sure to save the post currently being edited before navigating away to the previous/next post.
|
24 |
|
25 |
-
Compatible with WordPress 2.6+, 2.7+, 2.8+, 2.9+.
|
26 |
-
|
27 |
-
=>> Read the accompanying readme.txt file for more information. Also, visit the plugin's homepage
|
28 |
-
=>> for more information and the latest updates
|
29 |
-
|
30 |
-
Installation:
|
31 |
-
|
32 |
-
1. Download the file http://coffee2code.com/wp-plugins/admin-post-navigation.zip and unzip it into your
|
33 |
-
/wp-content/plugins/ directory (or install via the built-in WordPress plugin installer).
|
34 |
-
2. Activate the plugin through the 'Plugins' admin menu in WordPress
|
35 |
*/
|
36 |
|
37 |
/*
|
38 |
Copyright (c) 2008-2010 by Scott Reilly (aka coffee2code)
|
39 |
|
40 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
|
41 |
-
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
|
42 |
-
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
43 |
Software is furnished to do so, subject to the following conditions:
|
44 |
|
45 |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
@@ -50,33 +36,46 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRA
|
|
50 |
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
51 |
*/
|
52 |
|
53 |
-
if ( !class_exists('AdminPostNavigation') ) :
|
54 |
|
55 |
class AdminPostNavigation {
|
56 |
-
var $prev_text = '
|
57 |
-
var $next_text = '
|
|
|
|
|
|
|
58 |
|
59 |
/**
|
60 |
* Class constructor: initializes class variables and adds actions and filters.
|
61 |
*/
|
62 |
function AdminPostNavigation() {
|
63 |
global $pagenow;
|
64 |
-
if (
|
65 |
-
$this->prev_text = __(
|
66 |
-
$this->next_text = __(
|
67 |
|
68 |
-
add_action('admin_init', array(&$this,'admin_init'));
|
69 |
-
add_action('admin_head', array(&$this, 'add_css'));
|
70 |
-
add_action('admin_footer', array(&$this, 'add_js'));
|
71 |
}
|
72 |
}
|
73 |
|
|
|
|
|
|
|
74 |
function admin_init() {
|
75 |
-
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
/**
|
79 |
* Adds the content for the post navigation meta_box.
|
|
|
|
|
|
|
|
|
80 |
*/
|
81 |
function add_meta_box( $object, $box ) {
|
82 |
global $post_ID;
|
@@ -84,20 +83,21 @@ class AdminPostNavigation {
|
|
84 |
$context = $object->post_type;
|
85 |
$prev = $this->previous_post();
|
86 |
if ( $prev ) {
|
87 |
-
$post_title =
|
88 |
-
$display .= '<a href="' . get_edit_post_link($prev->ID) .
|
89 |
"\" id='admin-post-nav-prev' title='Previous $context: $post_title' class='admin-post-nav-prev'>{$this->prev_text}</a>";
|
90 |
}
|
91 |
$next = $this->next_post();
|
92 |
if ( $next ) {
|
93 |
-
if ( !empty($display) )
|
94 |
$display .= ' | ';
|
95 |
-
$post_title =
|
96 |
-
$display .= '<a href="' . get_edit_post_link($next->ID) .
|
97 |
"\" id='admin-post-nav-next' title='Next $context: $post_title' class='admin-post-nav-next'>{$this->next_text}</a>";
|
98 |
}
|
99 |
$display = '<span id="admin-post-nav">' . $display . '</span>';
|
100 |
-
|
|
|
101 |
}
|
102 |
|
103 |
/**
|
@@ -106,12 +106,8 @@ class AdminPostNavigation {
|
|
106 |
function add_css() {
|
107 |
echo <<<CSS
|
108 |
<style type="text/css">
|
109 |
-
#admin-post-nav {
|
110 |
-
|
111 |
-
}
|
112 |
-
h2 #admin-post-nav {
|
113 |
-
font-size:0.6em;
|
114 |
-
}
|
115 |
</style>
|
116 |
|
117 |
CSS;
|
@@ -132,8 +128,8 @@ CSS;
|
|
132 |
$('#admin-post-nav').appendTo($('h2'));
|
133 |
$('#adminpostnav').hide();
|
134 |
});
|
135 |
-
|
136 |
</script>
|
|
|
137 |
JS;
|
138 |
}
|
139 |
|
@@ -143,7 +139,7 @@ JS;
|
|
143 |
* Currently, a previous/next post is determined by the next lower/higher
|
144 |
* valid post based on relative sequential post ID and which the user can
|
145 |
* edit. Other post criteria such as post type (draft, pending, etc),
|
146 |
-
* publish date, post author, category, etc, are not taken into
|
147 |
* consideration when determining the previous or next post.
|
148 |
*
|
149 |
* @param string $type (optional) Either '<' or '>', indicating previous or next post, respectively. Default is '<'.
|
@@ -151,25 +147,26 @@ JS;
|
|
151 |
* @param int $limit (optional) Limit. Default is 15.
|
152 |
* @return string
|
153 |
*/
|
154 |
-
function query($type = '<', $offset = 0, $limit = 15) {
|
155 |
global $post_ID, $wpdb;
|
|
|
156 |
if ( $type != '<' )
|
157 |
$type = '>';
|
158 |
-
$offset = (int)$offset;
|
159 |
-
$limit = (int)$limit;
|
160 |
|
161 |
-
$sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' ";
|
162 |
if ( $post_ID )
|
163 |
$sql .= "AND ID $type $post_ID ";
|
164 |
$sort = $type == '<' ? 'DESC' : 'ASC';
|
165 |
-
$sql .= "ORDER BY
|
166 |
|
167 |
// Find the first one the user can actually edit
|
168 |
-
$posts = $wpdb->get_results($sql);
|
169 |
$result = false;
|
170 |
if ( $posts ) {
|
171 |
-
foreach ($posts as $post) {
|
172 |
-
if ( current_user_can('edit_post', $post->ID) ) {
|
173 |
$result = $post;
|
174 |
break;
|
175 |
}
|
@@ -178,7 +175,7 @@ JS;
|
|
178 |
$offset += $limit;
|
179 |
// Double the limit each time (if haven't found a post yet, chances are we may not, so try to get through posts quicker)
|
180 |
$limit += $limit;
|
181 |
-
return $this->query($type, $offset, $limit);
|
182 |
}
|
183 |
}
|
184 |
return $result;
|
@@ -192,7 +189,7 @@ JS;
|
|
192 |
* @return object The next post object.
|
193 |
*/
|
194 |
function next_post() {
|
195 |
-
return $this->query('>');
|
196 |
}
|
197 |
|
198 |
/**
|
@@ -203,14 +200,13 @@ JS;
|
|
203 |
* @return object The previous post object.
|
204 |
*/
|
205 |
function previous_post() {
|
206 |
-
return $this->query('<');
|
207 |
}
|
208 |
|
209 |
} // end AdminPostNavigation
|
210 |
|
211 |
-
|
212 |
|
213 |
-
if
|
214 |
-
new AdminPostNavigation();
|
215 |
|
216 |
?>
|
2 |
/**
|
3 |
* @package Admin_Post_Navigation
|
4 |
* @author Scott Reilly
|
5 |
+
* @version 1.5
|
6 |
*/
|
7 |
/*
|
8 |
Plugin Name: Admin Post Navigation
|
9 |
+
Version: 1.5
|
10 |
+
Plugin URI: http://coffee2code.com/wp-plugins/admin-post-navigation/
|
11 |
Author: Scott Reilly
|
12 |
Author URI: http://coffee2code.com
|
13 |
Description: Adds links to the next and previous posts when editing a post in the WordPress admin.
|
14 |
|
15 |
+
Compatible with WordPress 2.8+, 2.9+, 3.0+.
|
|
|
|
|
16 |
|
17 |
+
=>> Read the accompanying readme.txt file for instructions and documentation.
|
18 |
+
=>> Also, visit the plugin's homepage for additional information and updates.
|
19 |
+
=>> Or visit: http://wordpress.org/extend/plugins/admin-post-navigation/
|
|
|
|
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
Copyright (c) 2008-2010 by Scott Reilly (aka coffee2code)
|
25 |
|
26 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
|
27 |
+
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
|
28 |
+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
29 |
Software is furnished to do so, subject to the following conditions:
|
30 |
|
31 |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
36 |
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
37 |
*/
|
38 |
|
39 |
+
if ( is_admin() && !class_exists( 'AdminPostNavigation' ) ) :
|
40 |
|
41 |
class AdminPostNavigation {
|
42 |
+
var $prev_text = '';
|
43 |
+
var $next_text = '';
|
44 |
+
|
45 |
+
var $orderby = 'ID'; // Filterable later
|
46 |
+
var $post_statuses = array( 'draft', 'future', 'pending', 'private', 'publish' ); // Filterable later
|
47 |
|
48 |
/**
|
49 |
* Class constructor: initializes class variables and adds actions and filters.
|
50 |
*/
|
51 |
function AdminPostNavigation() {
|
52 |
global $pagenow;
|
53 |
+
if ( 'post.php' == $pagenow ) {
|
54 |
+
$this->prev_text = __( '« Previous' );
|
55 |
+
$this->next_text = __( 'Next »' );
|
56 |
|
57 |
+
add_action( 'admin_init', array( &$this,'admin_init' ) );
|
58 |
+
add_action( 'admin_head', array( &$this, 'add_css' ) );
|
59 |
+
add_action( 'admin_footer', array( &$this, 'add_js' ) );
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* Initialize variables and meta_box
|
65 |
+
*/
|
66 |
function admin_init() {
|
67 |
+
$this->orderby = esc_sql( apply_filters( 'c2c_admin_post_navigation_orderby', $this->orderby ) ); // pre-1.5 this used to order by 'post_date'
|
68 |
+
$this->post_statuses = apply_filters( 'c2c_admin_post_navigation_post_statuses', $this->post_statuses );
|
69 |
+
$this->post_statuses = "'" . implode( "', '", array_map( 'esc_sql', $this->post_statuses ) ) . "'";
|
70 |
+
add_meta_box( 'adminpostnav', 'Post Navigation', array( &$this, 'add_meta_box' ), 'post', 'side', 'core' );
|
71 |
}
|
72 |
|
73 |
/**
|
74 |
* Adds the content for the post navigation meta_box.
|
75 |
+
*
|
76 |
+
* @param object $object
|
77 |
+
* @param array $box
|
78 |
+
* @return void (Text is echoed.)
|
79 |
*/
|
80 |
function add_meta_box( $object, $box ) {
|
81 |
global $post_ID;
|
83 |
$context = $object->post_type;
|
84 |
$prev = $this->previous_post();
|
85 |
if ( $prev ) {
|
86 |
+
$post_title = esc_attr( strip_tags( get_the_title( $prev->ID ) ) );
|
87 |
+
$display .= '<a href="' . get_edit_post_link( $prev->ID ) .
|
88 |
"\" id='admin-post-nav-prev' title='Previous $context: $post_title' class='admin-post-nav-prev'>{$this->prev_text}</a>";
|
89 |
}
|
90 |
$next = $this->next_post();
|
91 |
if ( $next ) {
|
92 |
+
if ( !empty( $display ) )
|
93 |
$display .= ' | ';
|
94 |
+
$post_title = esc_attr( strip_tags( get_the_title( $next->ID ) ) );
|
95 |
+
$display .= '<a href="' . get_edit_post_link( $next->ID ) .
|
96 |
"\" id='admin-post-nav-next' title='Next $context: $post_title' class='admin-post-nav-next'>{$this->next_text}</a>";
|
97 |
}
|
98 |
$display = '<span id="admin-post-nav">' . $display . '</span>';
|
99 |
+
$display = apply_filters( 'admin_post_nav', $display ); /* Deprecated as of v1.5 */
|
100 |
+
echo apply_filters( 'c2c_admin_post_navigation_display', $display );
|
101 |
}
|
102 |
|
103 |
/**
|
106 |
function add_css() {
|
107 |
echo <<<CSS
|
108 |
<style type="text/css">
|
109 |
+
#admin-post-nav {margin-left:20px;}
|
110 |
+
h2 #admin-post-nav {font-size:0.6em;}
|
|
|
|
|
|
|
|
|
111 |
</style>
|
112 |
|
113 |
CSS;
|
128 |
$('#admin-post-nav').appendTo($('h2'));
|
129 |
$('#adminpostnav').hide();
|
130 |
});
|
|
|
131 |
</script>
|
132 |
+
|
133 |
JS;
|
134 |
}
|
135 |
|
139 |
* Currently, a previous/next post is determined by the next lower/higher
|
140 |
* valid post based on relative sequential post ID and which the user can
|
141 |
* edit. Other post criteria such as post type (draft, pending, etc),
|
142 |
+
* publish date, post author, category, etc, are not taken into
|
143 |
* consideration when determining the previous or next post.
|
144 |
*
|
145 |
* @param string $type (optional) Either '<' or '>', indicating previous or next post, respectively. Default is '<'.
|
147 |
* @param int $limit (optional) Limit. Default is 15.
|
148 |
* @return string
|
149 |
*/
|
150 |
+
function query( $type = '<', $offset = 0, $limit = 15 ) {
|
151 |
global $post_ID, $wpdb;
|
152 |
+
|
153 |
if ( $type != '<' )
|
154 |
$type = '>';
|
155 |
+
$offset = (int) $offset;
|
156 |
+
$limit = (int) $limit;
|
157 |
|
158 |
+
$sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status IN ({$this->post_statuses}) ";
|
159 |
if ( $post_ID )
|
160 |
$sql .= "AND ID $type $post_ID ";
|
161 |
$sort = $type == '<' ? 'DESC' : 'ASC';
|
162 |
+
$sql .= "ORDER BY {$this->orderby} $sort LIMIT $offset, $limit";
|
163 |
|
164 |
// Find the first one the user can actually edit
|
165 |
+
$posts = $wpdb->get_results( $sql );
|
166 |
$result = false;
|
167 |
if ( $posts ) {
|
168 |
+
foreach ( $posts as $post ) {
|
169 |
+
if ( current_user_can( 'edit_post', $post->ID ) ) {
|
170 |
$result = $post;
|
171 |
break;
|
172 |
}
|
175 |
$offset += $limit;
|
176 |
// Double the limit each time (if haven't found a post yet, chances are we may not, so try to get through posts quicker)
|
177 |
$limit += $limit;
|
178 |
+
return $this->query( $type, $offset, $limit );
|
179 |
}
|
180 |
}
|
181 |
return $result;
|
189 |
* @return object The next post object.
|
190 |
*/
|
191 |
function next_post() {
|
192 |
+
return $this->query( '>' );
|
193 |
}
|
194 |
|
195 |
/**
|
200 |
* @return object The previous post object.
|
201 |
*/
|
202 |
function previous_post() {
|
203 |
+
return $this->query( '<' );
|
204 |
}
|
205 |
|
206 |
} // end AdminPostNavigation
|
207 |
|
208 |
+
$GLOBALS['c2c_admin_post_navigation'] = new AdminPostNavigation();
|
209 |
|
210 |
+
endif; // end if !class_exists()
|
|
|
211 |
|
212 |
?>
|
readme.txt
CHANGED
@@ -2,13 +2,14 @@
|
|
2 |
Contributors: coffee2code
|
3 |
Donate link: http://coffee2code.com/donate
|
4 |
Tags: admin, navigation, post, next, previous, edit, coffee2code
|
5 |
-
Requires at least: 2.
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.
|
8 |
-
Version: 1.
|
9 |
|
10 |
Adds links to the next and previous posts when editing a post in the WordPress admin.
|
11 |
|
|
|
12 |
== Description ==
|
13 |
|
14 |
Adds links to the next and previous posts when editing a post in the WordPress admin.
|
@@ -25,13 +26,91 @@ NOTE: Be sure to save the post currently being edited before navigating away to
|
|
25 |
1. Unzip `admin-post-navigation.zip` inside the `/wp-content/plugins/` directory for your site (or install via the built-in WordPress plugin installer)
|
26 |
1. Activate the plugin through the 'Plugins' admin menu in WordPress
|
27 |
|
|
|
28 |
== Screenshots ==
|
29 |
|
30 |
1. A screenshot of the previous/next links adjacent to the 'Edit Post' admin page header when Javascript is enabled.
|
31 |
2. A screenshot of the previous/next links in their own 'Edit Post' admin page sidebar panel when Javascript is disabled for the admin user.
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
= 1.1.1 =
|
36 |
* Add PHPDoc documentation
|
37 |
* Note compatibility with WP 2.9+
|
@@ -46,3 +125,9 @@ NOTE: Be sure to save the post currently being edited before navigating away to
|
|
46 |
|
47 |
= 1.0 =
|
48 |
* Initial release
|
|
|
|
|
|
|
|
|
|
|
|
2 |
Contributors: coffee2code
|
3 |
Donate link: http://coffee2code.com/donate
|
4 |
Tags: admin, navigation, post, next, previous, edit, coffee2code
|
5 |
+
Requires at least: 2.8
|
6 |
+
Tested up to: 3.0.1
|
7 |
+
Stable tag: 1.5
|
8 |
+
Version: 1.5
|
9 |
|
10 |
Adds links to the next and previous posts when editing a post in the WordPress admin.
|
11 |
|
12 |
+
|
13 |
== Description ==
|
14 |
|
15 |
Adds links to the next and previous posts when editing a post in the WordPress admin.
|
26 |
1. Unzip `admin-post-navigation.zip` inside the `/wp-content/plugins/` directory for your site (or install via the built-in WordPress plugin installer)
|
27 |
1. Activate the plugin through the 'Plugins' admin menu in WordPress
|
28 |
|
29 |
+
|
30 |
== Screenshots ==
|
31 |
|
32 |
1. A screenshot of the previous/next links adjacent to the 'Edit Post' admin page header when Javascript is enabled.
|
33 |
2. A screenshot of the previous/next links in their own 'Edit Post' admin page sidebar panel when Javascript is disabled for the admin user.
|
34 |
|
35 |
+
|
36 |
+
== Filters ==
|
37 |
+
|
38 |
+
The plugin is further customizable via three filters. Typically, these customizations would be put into your active theme's functions.php file, or used by another plugin.
|
39 |
+
|
40 |
+
= c2c_admin_post_navigation_orderby =
|
41 |
+
|
42 |
+
The 'c2c_admin_post_navigation_orderby' filter allows you to change the post field used in the ORDER BY clause for the SQL to find the previous/next post. By default this is 'ID'. If you wish to change this, hook this filter. This is not typical usage for most users.
|
43 |
+
|
44 |
+
Arguments:
|
45 |
+
|
46 |
+
* $field (string) The current ORDER BY field
|
47 |
+
|
48 |
+
Example:
|
49 |
+
|
50 |
+
`add_filter( 'c2c_admin_post_navigation_orderby', 'order_apn_by_post_date' );
|
51 |
+
function order_apn_by_post_date( $field ) {
|
52 |
+
return 'post_date';
|
53 |
+
}`
|
54 |
+
|
55 |
+
= c2c_admin_post_navigation_post_statuses =
|
56 |
+
|
57 |
+
The 'c2c_admin_post_navigation_post_statuses' filter allows you to modify the list of post_statuses used as part of the search for the prev/next post. By default this array includes 'draft', 'future', 'pending', 'private', and 'publish'. If you wish to change this, hook this filter. This is not typical usage for most users.
|
58 |
+
|
59 |
+
Arguments:
|
60 |
+
|
61 |
+
* $post_statuses (array) The array of valid post_statuses
|
62 |
+
|
63 |
+
Example:
|
64 |
+
|
65 |
+
`add_filter( 'c2c_admin_post_navigation_post_statuses', 'change_apn_post_status' );
|
66 |
+
function change_apn_post_status( $post_statuses ) {
|
67 |
+
$post_statuses[] = 'trash'; // Adding a post status
|
68 |
+
if ( isset( $post_statuses['future'] ) ) unset( $post_statuses['future'] ); // Removing a post status
|
69 |
+
return $post_statuses;
|
70 |
+
}`
|
71 |
+
|
72 |
+
= c2c_admin_post_navigation_display =
|
73 |
+
|
74 |
+
The 'c2c_admin_post_navigation_display' filter allows you to customize the output links for the post navigation.
|
75 |
+
|
76 |
+
Arguments:
|
77 |
+
|
78 |
+
* $text (string) The current output for the prev/next navigation link
|
79 |
+
|
80 |
+
Example:
|
81 |
+
|
82 |
+
`add_filter( 'c2c_admin_post_navigation_display', 'override_apn_display' );
|
83 |
+
function override_apn_display( $text ) {
|
84 |
+
// Simplistic example. You could preferably make the text bold using CSS.
|
85 |
+
return '<strong>' . $text . '</strong>';
|
86 |
+
}`
|
87 |
+
|
88 |
+
|
89 |
== Changelog ==
|
90 |
|
91 |
+
= 1.5 =
|
92 |
+
* Change post search ORDER BY from 'post_date' to 'ID'
|
93 |
+
* Add filter 'c2c_admin_post_navigation_orderby' for customizing search ORDER BY field
|
94 |
+
* Add filter 'c2c_admin_post_navigation_post_statuses' for customizing valid post_statuses for search
|
95 |
+
* Deprecate (but still support) 'admin_post_nav' filter
|
96 |
+
* Add filter 'c2c_admin_post_navigation_display' filter as replacement to 'admin_post_nav' filter to allow modifying output
|
97 |
+
* Retrieve post title via get_the_title() rather than directly from object
|
98 |
+
* Also strip tags from the title prior to use in tag attribute
|
99 |
+
* Don't navigate to auto-saves
|
100 |
+
* Check for is_admin() before defining class rather than during constructor
|
101 |
+
* esc_sql() on SQL strings that have potentially been filtered
|
102 |
+
* Use esc_attr() instead of attribute_escape()
|
103 |
+
* Store plugin instance in global variable, $c2c_admin_post_navigation, to allow for external manipulation
|
104 |
+
* Fix localization of the two strings
|
105 |
+
* Instantiate object within primary class_exists() check
|
106 |
+
* Note compatibility with WP 3.0+
|
107 |
+
* Drop compatibility with version of WP older than 2.8
|
108 |
+
* Minor code reformatting (spacing)
|
109 |
+
* Remove docs from top of plugin file (all that and more are in readme.txt)
|
110 |
+
* Remove trailing whitespace in header docs
|
111 |
+
* Add Upgrade Notice and Filters sections to readme.txt
|
112 |
+
* Add package info to top of plugin file
|
113 |
+
|
114 |
= 1.1.1 =
|
115 |
* Add PHPDoc documentation
|
116 |
* Note compatibility with WP 2.9+
|
125 |
|
126 |
= 1.0 =
|
127 |
* Initial release
|
128 |
+
|
129 |
+
|
130 |
+
== Upgrade Notice ==
|
131 |
+
|
132 |
+
= 1.5 =
|
133 |
+
Recommended update. Highlights: find prev/next post by ID rather than post_date, added verified WP 3.0 compatibility.
|