Version Description
Download this release
Release Info
| Developer | giucu91 |
| Plugin | |
| Version | 2.4.8 |
| Comparing to | |
| See all releases | |
Code changes from version 2.4.7 to 2.4.8
- readme.txt +5 -2
- settings.php +78 -1
- simple-custom-post-order.php +43 -4
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: silkalns
|
|
| 3 |
Tags: custom post order, post order, js post order, page order, posts order, category order, sort posts, sort pages, sort custom posts
|
| 4 |
Requires at least: 4.6
|
| 5 |
Requires PHP: 5.6
|
| 6 |
-
Tested up to: 5.
|
| 7 |
-
Stable tag: 2.4.
|
| 8 |
License: GPLv3 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 10 |
|
|
@@ -36,6 +36,9 @@ An answer to that question.
|
|
| 36 |
|
| 37 |
== Changelog ==
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
= Version 2.4.7 =
|
| 40 |
* Fix undefined index when ordering terms
|
| 41 |
* Added filter for post types args shown in settings page
|
| 3 |
Tags: custom post order, post order, js post order, page order, posts order, category order, sort posts, sort pages, sort custom posts
|
| 4 |
Requires at least: 4.6
|
| 5 |
Requires PHP: 5.6
|
| 6 |
+
Tested up to: 5.3
|
| 7 |
+
Stable tag: 2.4.8
|
| 8 |
License: GPLv3 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 10 |
|
| 36 |
|
| 37 |
== Changelog ==
|
| 38 |
|
| 39 |
+
= Version 2.4.8 =
|
| 40 |
+
* Add ability to reset order to post types
|
| 41 |
+
|
| 42 |
= Version 2.4.7 =
|
| 43 |
* Fix undefined index when ordering terms
|
| 44 |
* Added filter for post types args shown in settings page
|
settings.php
CHANGED
|
@@ -98,7 +98,12 @@ $advanced_view = isset($scporder_options['show_advanced_view']) ? $scporder_opti
|
|
| 98 |
.epsilon-toggle__input[type=checkbox]:checked + .epsilon-toggle__items .epsilon-toggle__on {
|
| 99 |
display: inline-block;
|
| 100 |
}
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
<div class="wrap">
|
| 103 |
<h2><?php _e('Simple Custom Post Order Settings', 'simple-custom-post-order'); ?></h2>
|
| 104 |
<?php if (isset($_GET['msg'])) : ?>
|
|
@@ -289,6 +294,51 @@ $advanced_view = isset($scporder_options['show_advanced_view']) ? $scporder_opti
|
|
| 289 |
</p>
|
| 290 |
|
| 291 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
<h3>Like this simple plugin?</h3>
|
| 293 |
<p>Make sure to <a href="https://wordpress.org/support/plugin/simple-custom-post-order/reviews/?filter=5"><strong>rate it</strong></a> and visit us at <a href="https://colorlib.com/wp/"><strong>Colorlib.com</strong></a></p>
|
| 294 |
|
|
@@ -314,5 +364,32 @@ $advanced_view = isset($scporder_options['show_advanced_view']) ? $scporder_opti
|
|
| 314 |
$(items).prop('checked', false);
|
| 315 |
});
|
| 316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
})(jQuery)
|
| 318 |
</script>
|
| 98 |
.epsilon-toggle__input[type=checkbox]:checked + .epsilon-toggle__items .epsilon-toggle__on {
|
| 99 |
display: inline-block;
|
| 100 |
}
|
| 101 |
+
|
| 102 |
+
.scpo-reset-response {
|
| 103 |
+
margin-left:15px;
|
| 104 |
+
color:#0085ba;
|
| 105 |
+
}
|
| 106 |
+
</style>
|
| 107 |
<div class="wrap">
|
| 108 |
<h2><?php _e('Simple Custom Post Order Settings', 'simple-custom-post-order'); ?></h2>
|
| 109 |
<?php if (isset($_GET['msg'])) : ?>
|
| 294 |
</p>
|
| 295 |
|
| 296 |
</form>
|
| 297 |
+
<div class="scpo-reset-order">
|
| 298 |
+
<h1>Want to reset the order of the posts?</h1>
|
| 299 |
+
<div id="scpo_reset_select_objects">
|
| 300 |
+
<table class="form-table">
|
| 301 |
+
<tbody>
|
| 302 |
+
<tr valign="top">
|
| 303 |
+
<th scope="row"><?php _e('Check to reset order of Post Types', 'simple-custom-post-order') ?></th>
|
| 304 |
+
<td>
|
| 305 |
+
<?php
|
| 306 |
+
foreach ($post_types as $post_type) {
|
| 307 |
+
if ($post_type->name == 'attachment')
|
| 308 |
+
continue;
|
| 309 |
+
?>
|
| 310 |
+
<label>
|
| 311 |
+
<div class="epsilon-toggle">
|
| 312 |
+
<input class="epsilon-toggle__input" type="checkbox"
|
| 313 |
+
name="<?php echo $post_type->name; ?>" value="">
|
| 314 |
+
<div class="epsilon-toggle__items">
|
| 315 |
+
<span class="epsilon-toggle__track"></span>
|
| 316 |
+
<span class="epsilon-toggle__thumb"></span>
|
| 317 |
+
<svg class="epsilon-toggle__off" width="6" height="6" aria-hidden="true"
|
| 318 |
+
role="img" focusable="false" viewBox="0 0 6 6">
|
| 319 |
+
<path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path>
|
| 320 |
+
</svg>
|
| 321 |
+
<svg class="epsilon-toggle__on" width="2" height="6" aria-hidden="true"
|
| 322 |
+
role="img" focusable="false" viewBox="0 0 2 6">
|
| 323 |
+
<path d="M0 0h2v6H0z"></path>
|
| 324 |
+
</svg>
|
| 325 |
+
</div>
|
| 326 |
+
</div>
|
| 327 |
+
<?php echo $post_type->label; ?></label><br>
|
| 328 |
+
<?php
|
| 329 |
+
}
|
| 330 |
+
?>
|
| 331 |
+
</td>
|
| 332 |
+
</tr>
|
| 333 |
+
</tbody>
|
| 334 |
+
</table>
|
| 335 |
+
|
| 336 |
+
</div>
|
| 337 |
+
<div>
|
| 338 |
+
<a id="reset-scp-order" class="button button-primary" href="#">Reset order</a>
|
| 339 |
+
<span class="scpo-reset-response"></span>
|
| 340 |
+
</div>
|
| 341 |
+
</div>
|
| 342 |
<h3>Like this simple plugin?</h3>
|
| 343 |
<p>Make sure to <a href="https://wordpress.org/support/plugin/simple-custom-post-order/reviews/?filter=5"><strong>rate it</strong></a> and visit us at <a href="https://colorlib.com/wp/"><strong>Colorlib.com</strong></a></p>
|
| 344 |
|
| 364 |
$(items).prop('checked', false);
|
| 365 |
});
|
| 366 |
|
| 367 |
+
// Reset order function
|
| 368 |
+
$('#reset-scp-order').click(function (e) {
|
| 369 |
+
|
| 370 |
+
e.preventDefault();
|
| 371 |
+
var btn = $(this),
|
| 372 |
+
item_input = $(this).parents('.scpo-reset-order').find('input:checked'),
|
| 373 |
+
items = [],
|
| 374 |
+
data = {
|
| 375 |
+
action: 'scpo_reset_order',
|
| 376 |
+
scpo_security: '<?php echo wp_create_nonce("scpo-reset-order"); ?>'
|
| 377 |
+
};
|
| 378 |
+
|
| 379 |
+
if (item_input.length > 0) {
|
| 380 |
+
item_input.each(function (i, item) {
|
| 381 |
+
items.push(item.name);
|
| 382 |
+
});
|
| 383 |
+
|
| 384 |
+
data['items'] = items;
|
| 385 |
+
|
| 386 |
+
$.post("<?php echo admin_url('admin-ajax.php'); ?>", data, function (response) {
|
| 387 |
+
if (response) {
|
| 388 |
+
btn.next('.scpo-reset-response').text(response);
|
| 389 |
+
}
|
| 390 |
+
});
|
| 391 |
+
}
|
| 392 |
+
});
|
| 393 |
+
|
| 394 |
})(jQuery)
|
| 395 |
</script>
|
simple-custom-post-order.php
CHANGED
|
@@ -3,10 +3,10 @@
|
|
| 3 |
* Plugin Name: Simple Custom Post Order
|
| 4 |
* Plugin URI: https://wordpress.org/plugins-wp/simple-custom-post-order/
|
| 5 |
* Description: Order Items (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
|
| 6 |
-
* Version: 2.4.
|
| 7 |
* Author: Colorlib
|
| 8 |
* Author URI: https://colorlib.com/
|
| 9 |
-
* Tested up to: 5.
|
| 10 |
* Requires: 4.6 or higher
|
| 11 |
* License: GPLv3 or later
|
| 12 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
|
@@ -36,7 +36,7 @@
|
|
| 36 |
|
| 37 |
define('SCPORDER_URL', plugins_url('', __FILE__));
|
| 38 |
define('SCPORDER_DIR', plugin_dir_path(__FILE__));
|
| 39 |
-
define('SCPORDER_VERSION', '2.4.
|
| 40 |
|
| 41 |
$scporder = new SCPO_Engine();
|
| 42 |
|
|
@@ -48,7 +48,7 @@ class SCPO_Engine {
|
|
| 48 |
|
| 49 |
add_action('admin_menu', array($this, 'admin_menu'));
|
| 50 |
|
| 51 |
-
add_action('admin_init', array($this, 'refresh'));
|
| 52 |
|
| 53 |
add_action('admin_init', array($this, 'update_options'));
|
| 54 |
add_action('admin_init', array($this, 'load_script_css'));
|
|
@@ -73,6 +73,8 @@ class SCPO_Engine {
|
|
| 73 |
add_action( 'plugins_loaded', array( $this, 'load_scpo_textdomain' ) );
|
| 74 |
|
| 75 |
add_filter('scpo_post_types_args',array($this,'scpo_filter_post_types'),10,2);
|
|
|
|
|
|
|
| 76 |
}
|
| 77 |
|
| 78 |
public function scpo_filter_post_types($args,$options){
|
|
@@ -230,6 +232,7 @@ class SCPO_Engine {
|
|
| 230 |
$tags = $this->get_scporder_options_tags();
|
| 231 |
|
| 232 |
if (!empty($objects)) {
|
|
|
|
| 233 |
foreach ($objects as $object) {
|
| 234 |
$result = $wpdb->get_results("
|
| 235 |
SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min
|
|
@@ -586,6 +589,42 @@ class SCPO_Engine {
|
|
| 586 |
return $tags;
|
| 587 |
}
|
| 588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
}
|
| 590 |
|
| 591 |
/**
|
| 3 |
* Plugin Name: Simple Custom Post Order
|
| 4 |
* Plugin URI: https://wordpress.org/plugins-wp/simple-custom-post-order/
|
| 5 |
* Description: Order Items (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
|
| 6 |
+
* Version: 2.4.8
|
| 7 |
* Author: Colorlib
|
| 8 |
* Author URI: https://colorlib.com/
|
| 9 |
+
* Tested up to: 5.3
|
| 10 |
* Requires: 4.6 or higher
|
| 11 |
* License: GPLv3 or later
|
| 12 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 36 |
|
| 37 |
define('SCPORDER_URL', plugins_url('', __FILE__));
|
| 38 |
define('SCPORDER_DIR', plugin_dir_path(__FILE__));
|
| 39 |
+
define('SCPORDER_VERSION', '2.4.8');
|
| 40 |
|
| 41 |
$scporder = new SCPO_Engine();
|
| 42 |
|
| 48 |
|
| 49 |
add_action('admin_menu', array($this, 'admin_menu'));
|
| 50 |
|
| 51 |
+
// add_action('admin_init', array($this, 'refresh'));
|
| 52 |
|
| 53 |
add_action('admin_init', array($this, 'update_options'));
|
| 54 |
add_action('admin_init', array($this, 'load_script_css'));
|
| 73 |
add_action( 'plugins_loaded', array( $this, 'load_scpo_textdomain' ) );
|
| 74 |
|
| 75 |
add_filter('scpo_post_types_args',array($this,'scpo_filter_post_types'),10,2);
|
| 76 |
+
|
| 77 |
+
add_action('wp_ajax_scpo_reset_order', array($this, 'scpo_ajax_reset_order'));
|
| 78 |
}
|
| 79 |
|
| 80 |
public function scpo_filter_post_types($args,$options){
|
| 232 |
$tags = $this->get_scporder_options_tags();
|
| 233 |
|
| 234 |
if (!empty($objects)) {
|
| 235 |
+
|
| 236 |
foreach ($objects as $object) {
|
| 237 |
$result = $wpdb->get_results("
|
| 238 |
SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min
|
| 589 |
return $tags;
|
| 590 |
}
|
| 591 |
|
| 592 |
+
/**
|
| 593 |
+
* SCPO reset order for post types/taxonomies
|
| 594 |
+
*/
|
| 595 |
+
public function scpo_ajax_reset_order() {
|
| 596 |
+
|
| 597 |
+
global $wpdb;
|
| 598 |
+
if ('scpo_reset_order' == $_POST['action']) {
|
| 599 |
+
check_ajax_referer('scpo-reset-order', 'scpo_security');
|
| 600 |
+
$items = $_POST['items'];
|
| 601 |
+
|
| 602 |
+
$count = 0;
|
| 603 |
+
$in_list = "(";
|
| 604 |
+
foreach ($items as $item) {
|
| 605 |
+
|
| 606 |
+
if ($count != 0) {
|
| 607 |
+
$in_list .= ',';
|
| 608 |
+
}
|
| 609 |
+
$in_list .= '\'' . $item . '\'';
|
| 610 |
+
$count++;
|
| 611 |
+
}
|
| 612 |
+
$in_list .= ")";
|
| 613 |
+
|
| 614 |
+
$prep_posts_query = "UPDATE $wpdb->posts SET `menu_order` = 0 WHERE `post_type` IN $in_list";
|
| 615 |
+
|
| 616 |
+
$result = $wpdb->query($prep_posts_query);
|
| 617 |
+
|
| 618 |
+
if ($result) {
|
| 619 |
+
echo 'Items have been reset';
|
| 620 |
+
} else {
|
| 621 |
+
echo false;
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
wp_die();
|
| 625 |
+
}
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
}
|
| 629 |
|
| 630 |
/**
|
