Version Description
- Released 2016-08-12
- Added screen options to set the number of posts displayed
Download this release
Release Info
Developer | ronalfy |
Plugin | Reorder Posts |
Version | 2.3.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.2 to 2.3.0
- class-reorder.php +44 -4
- index.php +1 -1
- readme.txt +8 -1
class-reorder.php
CHANGED
@@ -153,7 +153,15 @@ final class MN_Reorder {
|
|
153 |
* @param array $args If not set, then uses $defaults instead
|
154 |
*/
|
155 |
public function __construct( $args = array() ) {
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
// Parse arguments
|
158 |
$defaults = array(
|
159 |
'post_type' => 'post', // Setting the post type to be reordered
|
@@ -163,11 +171,11 @@ final class MN_Reorder {
|
|
163 |
'final' => '', // Initial text displayed before sorting code
|
164 |
'post_status' => 'publish', // Post status of posts to be reordered
|
165 |
'menu_label' => __( 'Reorder', 'metronet-reorder-posts' ), //Menu label for the post type
|
166 |
-
'offset' =>
|
167 |
-
'posts_per_page' =>
|
168 |
);
|
169 |
$args = wp_parse_args( $args, $defaults );
|
170 |
-
|
171 |
// Set variables
|
172 |
$this->post_type = $args[ 'post_type' ];
|
173 |
$this->order = $args[ 'order' ];;
|
@@ -185,6 +193,7 @@ final class MN_Reorder {
|
|
185 |
}
|
186 |
|
187 |
// Add actions
|
|
|
188 |
add_action( 'wp_ajax_post_sort', array( $this, 'ajax_save_post_order' ) );
|
189 |
add_action( 'admin_menu', array( $this, 'enable_post_sort' ), 10, 'page' );
|
190 |
add_action( 'metronet_reorder_posts_interface_' . $this->post_type, array( $this, 'output_interface' ) );
|
@@ -366,12 +375,43 @@ final class MN_Reorder {
|
|
366 |
);
|
367 |
$this->reorder_page = add_query_arg( array( 'page' => 'reorder-posts' ), admin_url( 'edit.php' ) );
|
368 |
}
|
|
|
369 |
do_action( 'metronet_reorder_posts_add_menu_' . $post_type, $hook ); //Allow other plugin authors to add scripts/styles to our menu items
|
370 |
do_action( 'metronet_reorder_menu_url_' . $post_type, $this->reorder_page );
|
371 |
add_action( 'admin_print_styles-' . $hook, array( $this, 'print_styles' ) );
|
372 |
add_action( 'admin_print_scripts-' . $hook, array( $this, 'print_scripts' ) );
|
373 |
}
|
374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
/**
|
376 |
* Output the main Reorder Interface
|
377 |
*
|
153 |
* @param array $args If not set, then uses $defaults instead
|
154 |
*/
|
155 |
public function __construct( $args = array() ) {
|
156 |
+
|
157 |
+
// Get posts per page
|
158 |
+
$user_id = get_current_user_id();
|
159 |
+
$posts_per_page = get_user_meta( $user_id, 'reorder_items_per_page', true );
|
160 |
+
if ( ! is_numeric( $posts_per_page ) ) {
|
161 |
+
$posts_per_page = 50;
|
162 |
+
}
|
163 |
+
$offset = $posts_per_page - 2;
|
164 |
+
|
165 |
// Parse arguments
|
166 |
$defaults = array(
|
167 |
'post_type' => 'post', // Setting the post type to be reordered
|
171 |
'final' => '', // Initial text displayed before sorting code
|
172 |
'post_status' => 'publish', // Post status of posts to be reordered
|
173 |
'menu_label' => __( 'Reorder', 'metronet-reorder-posts' ), //Menu label for the post type
|
174 |
+
'offset' => $offset,
|
175 |
+
'posts_per_page' => $posts_per_page
|
176 |
);
|
177 |
$args = wp_parse_args( $args, $defaults );
|
178 |
+
|
179 |
// Set variables
|
180 |
$this->post_type = $args[ 'post_type' ];
|
181 |
$this->order = $args[ 'order' ];;
|
193 |
}
|
194 |
|
195 |
// Add actions
|
196 |
+
add_filter( 'set-screen-option', array( $this, 'add_screen_option_save' ), 10, 3 );
|
197 |
add_action( 'wp_ajax_post_sort', array( $this, 'ajax_save_post_order' ) );
|
198 |
add_action( 'admin_menu', array( $this, 'enable_post_sort' ), 10, 'page' );
|
199 |
add_action( 'metronet_reorder_posts_interface_' . $this->post_type, array( $this, 'output_interface' ) );
|
375 |
);
|
376 |
$this->reorder_page = add_query_arg( array( 'page' => 'reorder-posts' ), admin_url( 'edit.php' ) );
|
377 |
}
|
378 |
+
add_action( "load-$hook", array( $this, 'add_screen_option' ) );
|
379 |
do_action( 'metronet_reorder_posts_add_menu_' . $post_type, $hook ); //Allow other plugin authors to add scripts/styles to our menu items
|
380 |
do_action( 'metronet_reorder_menu_url_' . $post_type, $this->reorder_page );
|
381 |
add_action( 'admin_print_styles-' . $hook, array( $this, 'print_styles' ) );
|
382 |
add_action( 'admin_print_scripts-' . $hook, array( $this, 'print_scripts' ) );
|
383 |
}
|
384 |
|
385 |
+
/**
|
386 |
+
* Add screen option for setting items per page
|
387 |
+
*
|
388 |
+
* @author Ronald Huereca
|
389 |
+
* @since 2.3.0
|
390 |
+
* @access public
|
391 |
+
*/
|
392 |
+
public function add_screen_option() {
|
393 |
+
$args = array(
|
394 |
+
'label' => __( 'Items per Page', 'metronet_reorder_posts' ),
|
395 |
+
'default' => 50,
|
396 |
+
'option' => 'reorder_items_per_page'
|
397 |
+
);
|
398 |
+
|
399 |
+
add_screen_option( 'per_page', $args );
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Saves the screen options setting
|
404 |
+
*
|
405 |
+
* @author Ronald Huereca
|
406 |
+
* @since 2.3.0
|
407 |
+
* @access public
|
408 |
+
*/
|
409 |
+
public function add_screen_option_save( $status, $option, $value ) {
|
410 |
+
if ( 'reorder_items_per_page' == $option ) return $value;
|
411 |
+
|
412 |
+
return $status;
|
413 |
+
}
|
414 |
+
|
415 |
/**
|
416 |
* Output the main Reorder Interface
|
417 |
*
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Reorder Posts
|
4 |
Plugin URI: https://wordpress.org/plugins/metronet-reorder-posts/
|
5 |
Description: Easily reorder posts and pages in WordPress
|
6 |
-
Version: 2.
|
7 |
Author: Ryan Hellyer, Ronald Huereca, Scott Basgaard
|
8 |
Author URI: https://github.com/ronalfy/reorder-posts
|
9 |
Text Domain: metronet-reorder-posts
|
3 |
Plugin Name: Reorder Posts
|
4 |
Plugin URI: https://wordpress.org/plugins/metronet-reorder-posts/
|
5 |
Description: Easily reorder posts and pages in WordPress
|
6 |
+
Version: 2.3.0
|
7 |
Author: Ryan Hellyer, Ronald Huereca, Scott Basgaard
|
8 |
Author URI: https://github.com/ronalfy/reorder-posts
|
9 |
Text Domain: metronet-reorder-posts
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Plugin URL: https://wordpress.org/plugins/metronet-reorder-posts/
|
|
5 |
Requires at Least: 3.7
|
6 |
Tested up to: 4.6
|
7 |
Tags: reorder, re-order, posts, wordpress, post-type, ajax, admin, hierarchical, menu_order, ordering
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -121,6 +121,10 @@ No, but there is an add-on for this plugin called <a href="https://wordpress.org
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
|
|
|
|
|
|
|
|
124 |
= 2.2.2 =
|
125 |
* Released 2015-12-04
|
126 |
* Fixed loading animation that displays out of nowhere
|
@@ -217,6 +221,9 @@ No, but there is an add-on for this plugin called <a href="https://wordpress.org
|
|
217 |
|
218 |
== Upgrade Notice ==
|
219 |
|
|
|
|
|
|
|
220 |
= 2.2.2 =
|
221 |
Fixing loading animation CSS issue
|
222 |
|
5 |
Requires at Least: 3.7
|
6 |
Tested up to: 4.6
|
7 |
Tags: reorder, re-order, posts, wordpress, post-type, ajax, admin, hierarchical, menu_order, ordering
|
8 |
+
Stable tag: 2.3.0
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= 2.3.0 =
|
125 |
+
* Released 2016-08-12
|
126 |
+
* Added screen options to set the number of posts displayed
|
127 |
+
|
128 |
= 2.2.2 =
|
129 |
* Released 2015-12-04
|
130 |
* Fixed loading animation that displays out of nowhere
|
221 |
|
222 |
== Upgrade Notice ==
|
223 |
|
224 |
+
= 2.3.0 =
|
225 |
+
Added screen options to set the number of posts displayed
|
226 |
+
|
227 |
= 2.2.2 =
|
228 |
Fixing loading animation CSS issue
|
229 |
|