Version Description
- Ignore the Events Calendar posts
- Filter typo fix
Download this release
Release Info
Developer | nsp-code |
Plugin | Post Types Order |
Version | 1.9.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.9.3.9 to 1.9.4.1
- compatibility/the-events-calendar.php +24 -0
- include/class.cpto.php +35 -13
- include/class.functions.php +6 -6
- include/class.options.php +27 -27
- include/class.walkers.php +5 -3
- post-types-order.php +1 -1
- readme.txt +8 -3
compatibility/the-events-calendar.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
function ignore_post_types_order_sort( $ignore, $orderBy, $query )
|
5 |
+
{
|
6 |
+
if ( isset($query->query_vars) && !empty( $query->query_vars['post_type'] ))
|
7 |
+
{
|
8 |
+
$query_post_types = array();
|
9 |
+
foreach ( (array)$query->query_vars['post_type'] as $_post_type )
|
10 |
+
{
|
11 |
+
$query_post_types[] = $_post_type;
|
12 |
+
}
|
13 |
+
|
14 |
+
if ( in_array("tribe_events", $query_post_types ) )
|
15 |
+
$ignore = TRUE;
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
return $ignore;
|
20 |
+
}
|
21 |
+
add_filter( 'pto/posts_orderby/ignore', 'ignore_post_types_order_sort', 10, 3 );
|
22 |
+
|
23 |
+
|
24 |
+
?>
|
include/class.cpto.php
CHANGED
@@ -56,6 +56,8 @@
|
|
56 |
*/
|
57 |
function on_init()
|
58 |
{
|
|
|
|
|
59 |
|
60 |
if(is_admin())
|
61 |
return;
|
@@ -65,8 +67,12 @@
|
|
65 |
$options = $this->functions->get_options();
|
66 |
|
67 |
$navigation_sort_apply = ($options['navigation_sort_apply'] == "1") ? TRUE : FALSE;
|
|
|
|
|
68 |
$navigation_sort_apply = apply_filters('cpto/navigation_sort_apply', $navigation_sort_apply);
|
69 |
|
|
|
|
|
70 |
if( ! $navigation_sort_apply)
|
71 |
return;
|
72 |
|
@@ -162,6 +168,8 @@
|
|
162 |
|
163 |
global $post;
|
164 |
|
|
|
|
|
165 |
//temporary ignore ACF group and admin ajax calls, should be fixed within ACF plugin sometime later
|
166 |
if (is_object($post) && $post->post_type == "acf-field-group"
|
167 |
|| (defined('DOING_AJAX') && isset($_REQUEST['action']) && strpos($_REQUEST['action'], 'acf/') === 0))
|
@@ -170,7 +178,7 @@
|
|
170 |
if(isset($_POST['query']) && isset($_POST['query']['post__in']) && is_array($_POST['query']['post__in']) && count($_POST['query']['post__in']) > 0)
|
171 |
return $orderBy;
|
172 |
|
173 |
-
$orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
|
174 |
}
|
175 |
}
|
176 |
else
|
@@ -179,6 +187,8 @@
|
|
179 |
if ($options['use_query_ASC_DESC'] == "1")
|
180 |
$order = isset($query->query_vars['order']) ? " " . $query->query_vars['order'] : '';
|
181 |
|
|
|
|
|
182 |
if ($options['autosort'] == "1")
|
183 |
{
|
184 |
if(trim($orderBy) == '')
|
@@ -204,7 +214,7 @@
|
|
204 |
|
205 |
?>
|
206 |
<div class="error fade">
|
207 |
-
<p><strong><?php
|
208 |
</div>
|
209 |
<?php
|
210 |
}
|
@@ -352,8 +362,12 @@
|
|
352 |
$id = (int)$id;
|
353 |
|
354 |
$data = array('menu_order' => $position);
|
|
|
|
|
355 |
$data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
|
356 |
|
|
|
|
|
357 |
$wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
|
358 |
}
|
359 |
}
|
@@ -366,8 +380,12 @@
|
|
366 |
$id = (int)$id;
|
367 |
|
368 |
$data = array('menu_order' => $position, 'post_parent' => str_replace('item_', '', $key));
|
|
|
|
|
369 |
$data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
|
370 |
|
|
|
|
|
371 |
$wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
|
372 |
}
|
373 |
}
|
@@ -442,8 +460,12 @@
|
|
442 |
$data = array(
|
443 |
'menu_order' => $menu_order
|
444 |
);
|
|
|
|
|
445 |
$data = apply_filters('post-types-order_save-ajax-order', $data, $menu_order, $id);
|
446 |
|
|
|
|
|
447 |
$wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
|
448 |
}
|
449 |
|
@@ -493,14 +515,16 @@
|
|
493 |
|
494 |
if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] != 'show')
|
495 |
continue;
|
|
|
|
|
496 |
|
497 |
if ($post_type_name == 'post')
|
498 |
-
add_submenu_page('edit.php', __('Re-Order', 'post-types-order'), __('Re-Order', 'post-types-order'), $
|
499 |
elseif ($post_type_name == 'attachment')
|
500 |
-
add_submenu_page('upload.php', __('Re-Order', 'post-types-order'), __('Re-Order', 'post-types-order'), $
|
501 |
else
|
502 |
{
|
503 |
-
add_submenu_page('edit.php?post_type='.$post_type_name, __('Re-Order', 'post-types-order'), __('Re-Order', 'post-types-order'), $
|
504 |
}
|
505 |
}
|
506 |
}
|
@@ -511,7 +535,7 @@
|
|
511 |
?>
|
512 |
<div id="cpto" class="wrap">
|
513 |
<div class="icon32" id="icon-edit"><br></div>
|
514 |
-
<h2><?php echo $this->current_post_type->labels->singular_name . ' - '.
|
515 |
|
516 |
<?php $this->functions->cpt_info_box(); ?>
|
517 |
|
@@ -519,7 +543,7 @@
|
|
519 |
|
520 |
<noscript>
|
521 |
<div class="error message">
|
522 |
-
<p><?php
|
523 |
</div>
|
524 |
</noscript>
|
525 |
|
@@ -532,7 +556,7 @@
|
|
532 |
</div>
|
533 |
|
534 |
<p class="submit">
|
535 |
-
<a href="javascript: void(0)" id="save-order" class="button-primary"><?php
|
536 |
</p>
|
537 |
|
538 |
<?php wp_nonce_field( 'interface_sort_nonce', 'interface_sort_nonce' ); ?>
|
@@ -553,7 +577,7 @@
|
|
553 |
jQuery("html, body").animate({ scrollTop: 0 }, "fast");
|
554 |
|
555 |
jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize"), 'interface_sort_nonce' : jQuery('#interface_sort_nonce').val() }, function() {
|
556 |
-
jQuery("#ajax-response").html('<div class="message updated fade"><p><?php
|
557 |
jQuery("#ajax-response div").delay(3000).hide("slow");
|
558 |
});
|
559 |
});
|
@@ -580,7 +604,7 @@
|
|
580 |
$output = '';
|
581 |
|
582 |
$r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', array()) );
|
583 |
-
|
584 |
// Query pages.
|
585 |
$r['hierarchical'] = 0;
|
586 |
$args = array(
|
@@ -602,9 +626,7 @@
|
|
602 |
$output .= $this->walkTree($pages, $r['depth'], $r);
|
603 |
}
|
604 |
|
605 |
-
|
606 |
-
|
607 |
-
echo $output;
|
608 |
}
|
609 |
|
610 |
function walkTree($pages, $depth, $r)
|
56 |
*/
|
57 |
function on_init()
|
58 |
{
|
59 |
+
//add compatibility
|
60 |
+
include_once(CPTPATH . '/compatibility/the-events-calendar.php');
|
61 |
|
62 |
if(is_admin())
|
63 |
return;
|
67 |
$options = $this->functions->get_options();
|
68 |
|
69 |
$navigation_sort_apply = ($options['navigation_sort_apply'] == "1") ? TRUE : FALSE;
|
70 |
+
|
71 |
+
//Deprecated, rely on pto/navigation_sort_apply
|
72 |
$navigation_sort_apply = apply_filters('cpto/navigation_sort_apply', $navigation_sort_apply);
|
73 |
|
74 |
+
$navigation_sort_apply = apply_filters('pto/navigation_sort_apply', $navigation_sort_apply);
|
75 |
+
|
76 |
if( ! $navigation_sort_apply)
|
77 |
return;
|
78 |
|
168 |
|
169 |
global $post;
|
170 |
|
171 |
+
$order = apply_filters('pto/posts_order', '', $query);
|
172 |
+
|
173 |
//temporary ignore ACF group and admin ajax calls, should be fixed within ACF plugin sometime later
|
174 |
if (is_object($post) && $post->post_type == "acf-field-group"
|
175 |
|| (defined('DOING_AJAX') && isset($_REQUEST['action']) && strpos($_REQUEST['action'], 'acf/') === 0))
|
178 |
if(isset($_POST['query']) && isset($_POST['query']['post__in']) && is_array($_POST['query']['post__in']) && count($_POST['query']['post__in']) > 0)
|
179 |
return $orderBy;
|
180 |
|
181 |
+
$orderBy = "{$wpdb->posts}.menu_order {$order}, {$wpdb->posts}.post_date DESC";
|
182 |
}
|
183 |
}
|
184 |
else
|
187 |
if ($options['use_query_ASC_DESC'] == "1")
|
188 |
$order = isset($query->query_vars['order']) ? " " . $query->query_vars['order'] : '';
|
189 |
|
190 |
+
$order = apply_filters('pto/posts_order', $order, $query);
|
191 |
+
|
192 |
if ($options['autosort'] == "1")
|
193 |
{
|
194 |
if(trim($orderBy) == '')
|
214 |
|
215 |
?>
|
216 |
<div class="error fade">
|
217 |
+
<p><strong><?php esc_html_e('Post Types Order must be configured. Please go to', 'post-types-order'); ?> <a href="<?php echo esc_attr( get_admin_url() ); ?>options-general.php?page=cpto-options"><?php esc_html_e('Settings Page', 'post-types-order'); ?></a> <?php esc_html_e('make the configuration and save', 'post-types-order'); ?></strong></p>
|
218 |
</div>
|
219 |
<?php
|
220 |
}
|
362 |
$id = (int)$id;
|
363 |
|
364 |
$data = array('menu_order' => $position);
|
365 |
+
|
366 |
+
//Deprecated, rely on pto/save-ajax-order
|
367 |
$data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
|
368 |
|
369 |
+
$data = apply_filters('pto/save-ajax-order', $data, $key, $id);
|
370 |
+
|
371 |
$wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
|
372 |
}
|
373 |
}
|
380 |
$id = (int)$id;
|
381 |
|
382 |
$data = array('menu_order' => $position, 'post_parent' => str_replace('item_', '', $key));
|
383 |
+
|
384 |
+
//Deprecated, rely on pto/save-ajax-order
|
385 |
$data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
|
386 |
|
387 |
+
$data = apply_filters('pto/save-ajax-order', $data, $key, $id);
|
388 |
+
|
389 |
$wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
|
390 |
}
|
391 |
}
|
460 |
$data = array(
|
461 |
'menu_order' => $menu_order
|
462 |
);
|
463 |
+
|
464 |
+
//Deprecated, rely on pto/save-ajax-order
|
465 |
$data = apply_filters('post-types-order_save-ajax-order', $data, $menu_order, $id);
|
466 |
|
467 |
+
$data = apply_filters('pto/save-ajax-order', $data, $menu_order, $id);
|
468 |
+
|
469 |
$wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
|
470 |
}
|
471 |
|
515 |
|
516 |
if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] != 'show')
|
517 |
continue;
|
518 |
+
|
519 |
+
$required_capability = apply_filters('pto/edit_capability', $capability, $post_type_name);
|
520 |
|
521 |
if ($post_type_name == 'post')
|
522 |
+
add_submenu_page('edit.php', __('Re-Order', 'post-types-order'), __('Re-Order', 'post-types-order'), $required_capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
|
523 |
elseif ($post_type_name == 'attachment')
|
524 |
+
add_submenu_page('upload.php', __('Re-Order', 'post-types-order'), __('Re-Order', 'post-types-order'), $required_capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
|
525 |
else
|
526 |
{
|
527 |
+
add_submenu_page('edit.php?post_type='.$post_type_name, __('Re-Order', 'post-types-order'), __('Re-Order', 'post-types-order'), $required_capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
|
528 |
}
|
529 |
}
|
530 |
}
|
535 |
?>
|
536 |
<div id="cpto" class="wrap">
|
537 |
<div class="icon32" id="icon-edit"><br></div>
|
538 |
+
<h2><?php echo esc_html( $this->current_post_type->labels->singular_name . ' - '. esc_html__('Re-Order', 'post-types-order') ); ?></h2>
|
539 |
|
540 |
<?php $this->functions->cpt_info_box(); ?>
|
541 |
|
543 |
|
544 |
<noscript>
|
545 |
<div class="error message">
|
546 |
+
<p><?php esc_html_e('This plugin can\'t work without javascript, because it\'s use drag and drop and AJAX.', 'post-types-order'); ?></p>
|
547 |
</div>
|
548 |
</noscript>
|
549 |
|
556 |
</div>
|
557 |
|
558 |
<p class="submit">
|
559 |
+
<a href="javascript: void(0)" id="save-order" class="button-primary"><?php esc_html_e('Update', 'post-types-order' ); ?></a>
|
560 |
</p>
|
561 |
|
562 |
<?php wp_nonce_field( 'interface_sort_nonce', 'interface_sort_nonce' ); ?>
|
577 |
jQuery("html, body").animate({ scrollTop: 0 }, "fast");
|
578 |
|
579 |
jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize"), 'interface_sort_nonce' : jQuery('#interface_sort_nonce').val() }, function() {
|
580 |
+
jQuery("#ajax-response").html('<div class="message updated fade"><p><?php esc_html_e('Items Order Updated', 'post-types-order') ?></p></div>');
|
581 |
jQuery("#ajax-response div").delay(3000).hide("slow");
|
582 |
});
|
583 |
});
|
604 |
$output = '';
|
605 |
|
606 |
$r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', array()) );
|
607 |
+
|
608 |
// Query pages.
|
609 |
$r['hierarchical'] = 0;
|
610 |
$args = array(
|
626 |
$output .= $this->walkTree($pages, $r['depth'], $r);
|
627 |
}
|
628 |
|
629 |
+
echo wp_kses_post ( $output );
|
|
|
|
|
630 |
}
|
631 |
|
632 |
function walkTree($pages, $depth, $r)
|
include/class.functions.php
CHANGED
@@ -93,10 +93,10 @@
|
|
93 |
|
94 |
</div>
|
95 |
|
96 |
-
<p><?php
|
97 |
-
<h4><?php
|
98 |
-
<p><?php
|
99 |
-
<p><span style="color:#CC0000" class="dashicons dashicons-megaphone" alt="f488"> </span> <?php
|
100 |
|
101 |
<div class="clear"></div>
|
102 |
</div>
|
@@ -131,7 +131,7 @@
|
|
131 |
// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
|
132 |
if ( false !== strpos( $excluded_terms, ' and ' ) )
|
133 |
{
|
134 |
-
_deprecated_argument( __FUNCTION__, '3.3', sprintf(
|
135 |
$excluded_terms = explode( ' and ', $excluded_terms );
|
136 |
}
|
137 |
else
|
@@ -210,7 +210,7 @@
|
|
210 |
// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
|
211 |
if ( false !== strpos( $excluded_terms, ' and ' ) )
|
212 |
{
|
213 |
-
_deprecated_argument( __FUNCTION__, '3.3', sprintf(
|
214 |
$excluded_terms = explode( ' and ', $excluded_terms );
|
215 |
}
|
216 |
else
|
93 |
|
94 |
</div>
|
95 |
|
96 |
+
<p><?php esc_html_e('Did you find this plugin useful? Please support our work by purchasing the advanced version or write an article about this plugin in your blog with a link to our site', 'post-types-order') ?> <a href="http://www.nsp-code.com/" target="_blank"><strong>http://www.nsp-code.com/</strong></a>.</p>
|
97 |
+
<h4><?php esc_html_e('Did you know there is available an Advanced version of this plug-in?', 'post-types-order') ?> <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/"><?php _e('Read more', 'post-types-order') ?></a></h4>
|
98 |
+
<p><?php esc_html_e('Check our', 'post-types-order') ?> <a target="_blank" href="http://wordpress.org/plugins/taxonomy-terms-order/">Category Order - Taxonomy Terms Order</a> <?php esc_html_e('plugin which allow to custom sort categories and custom taxonomies terms', 'post-types-order') ?> </p>
|
99 |
+
<p><span style="color:#CC0000" class="dashicons dashicons-megaphone" alt="f488"> </span> <?php esc_html_e('Check out', 'post-types-order') ?> <a href="https://wordpress.org/plugins/wp-hide-security-enhancer/" target="_blank"><b>WP Hide & Security Enhancer</b></a> <?php esc_html_e('the easy way to completely hide your WordPress core files, theme and plugins', 'post-types-order') ?>.</p>
|
100 |
|
101 |
<div class="clear"></div>
|
102 |
</div>
|
131 |
// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
|
132 |
if ( false !== strpos( $excluded_terms, ' and ' ) )
|
133 |
{
|
134 |
+
_deprecated_argument( __FUNCTION__, '3.3', sprintf( esc_html__( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
|
135 |
$excluded_terms = explode( ' and ', $excluded_terms );
|
136 |
}
|
137 |
else
|
210 |
// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
|
211 |
if ( false !== strpos( $excluded_terms, ' and ' ) )
|
212 |
{
|
213 |
+
_deprecated_argument( __FUNCTION__, '3.3', sprintf( esc_html__( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
|
214 |
$excluded_terms = explode( ' and ', $excluded_terms );
|
215 |
}
|
216 |
else
|
include/class.options.php
CHANGED
@@ -37,7 +37,7 @@
|
|
37 |
|
38 |
$options['navigation_sort_apply'] = isset($_POST['navigation_sort_apply']) ? intval($_POST['navigation_sort_apply']) : '';
|
39 |
|
40 |
-
echo '<div class="updated fade"><p>' .
|
41 |
|
42 |
update_option('cpto_options', $options);
|
43 |
update_option('CPT_configured', 'TRUE');
|
@@ -54,17 +54,17 @@
|
|
54 |
?>
|
55 |
<div id="cpto" class="wrap">
|
56 |
<div id="icon-settings" class="icon32"></div>
|
57 |
-
<h2><?php
|
58 |
|
59 |
<?php $this->CPTO->functions->cpt_info_box(); ?>
|
60 |
|
61 |
<form id="form_data" name="form" method="post">
|
62 |
<br />
|
63 |
-
<h2 class="subtitle"><?php
|
64 |
<table class="form-table">
|
65 |
<tbody>
|
66 |
<tr valign="top">
|
67 |
-
<th scope="row" style="text-align: right;"><label><?php
|
68 |
<td>
|
69 |
<?php
|
70 |
|
@@ -90,73 +90,73 @@
|
|
90 |
continue;
|
91 |
?>
|
92 |
<p><label>
|
93 |
-
<select name="show_reorder_interfaces[<?php echo $post_type_name ?>]">
|
94 |
-
<option value="show" <?php if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] == 'show') {echo ' selected="selected"';} ?>><?php
|
95 |
-
<option value="hide" <?php if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] == 'hide') {echo ' selected="selected"';} ?>><?php
|
96 |
-
</select> <?php echo $post_type_data->labels->singular_name ?>
|
97 |
</label><br /> </p>
|
98 |
<?php } ?>
|
99 |
</td>
|
100 |
</tr>
|
101 |
<tr valign="top">
|
102 |
-
<th scope="row" style="text-align: right;"><label><?php
|
103 |
<td>
|
104 |
<select id="role" name="capability">
|
105 |
-
<option value="read" <?php if (isset($options['capability']) && $options['capability'] == "read") echo 'selected="selected"'?>><?php
|
106 |
-
<option value="edit_posts" <?php if (isset($options['capability']) && $options['capability'] == "edit_posts") echo 'selected="selected"'?>><?php
|
107 |
-
<option value="publish_posts" <?php if (isset($options['capability']) && $options['capability'] == "publish_posts") echo 'selected="selected"'?>><?php
|
108 |
-
<option value="publish_pages" <?php if (isset($options['capability']) && $options['capability'] == "publish_pages") echo 'selected="selected"'?>><?php
|
109 |
-
<option value="manage_options" <?php if (!isset($options['capability']) || empty($options['capability']) || (isset($options['capability']) && $options['capability'] == "manage_options")) echo 'selected="selected"'?>><?php
|
110 |
<?php do_action('pto/admin/plugin_options/capability') ?>
|
111 |
</select>
|
112 |
</td>
|
113 |
</tr>
|
114 |
|
115 |
<tr valign="top">
|
116 |
-
<th scope="row" style="text-align: right;"><label for="autosort"><?php
|
117 |
<td>
|
118 |
-
<p><input type="checkbox" <?php checked( '1', $options['autosort'] ); ?> id="autosort" value="1" name="autosort"> <?php
|
119 |
-
<p class="description"><?php
|
120 |
<br />
|
121 |
-
<a href="http://www.nsp-code.com/sample-code-on-how-to-apply-the-sort-for-post-types-order-plugin/" target="_blank"><?php
|
122 |
|
123 |
</td>
|
124 |
</tr>
|
125 |
|
126 |
|
127 |
<tr valign="top">
|
128 |
-
<th scope="row" style="text-align: right;"><label for="adminsort"><?php
|
129 |
<td>
|
130 |
<p>
|
131 |
<input type="checkbox" <?php checked( '1', $options['adminsort'] ); ?> id="adminsort" value="1" name="adminsort">
|
132 |
-
<?php
|
133 |
</td>
|
134 |
</tr>
|
135 |
|
136 |
<tr valign="top">
|
137 |
-
<th scope="row" style="text-align: right;"><label for="archive_drag_drop"><?php
|
138 |
<td>
|
139 |
<p>
|
140 |
<input type="checkbox" <?php checked( '1', $options['use_query_ASC_DESC'] ); ?> id="use_query_ASC_DESC" value="1" name="use_query_ASC_DESC">
|
141 |
-
<?php
|
142 |
</td>
|
143 |
</tr>
|
144 |
|
145 |
<tr valign="top">
|
146 |
-
<th scope="row" style="text-align: right;"><label for="archive_drag_drop"><?php
|
147 |
<td>
|
148 |
<p>
|
149 |
<input type="checkbox" <?php checked( '1', $options['archive_drag_drop'] ); ?> id="archive_drag_drop" value="1" name="archive_drag_drop">
|
150 |
-
<?php
|
151 |
</td>
|
152 |
</tr>
|
153 |
|
154 |
<tr valign="top">
|
155 |
-
<th scope="row" style="text-align: right;"><label for="navigation_sort_apply"><?php
|
156 |
<td>
|
157 |
<p>
|
158 |
<input type="checkbox" <?php checked( '1', $options['navigation_sort_apply'] ); ?> id="navigation_sort_apply" value="1" name="navigation_sort_apply">
|
159 |
-
<?php
|
160 |
</td>
|
161 |
</tr>
|
162 |
|
@@ -164,7 +164,7 @@
|
|
164 |
</table>
|
165 |
|
166 |
<p class="submit">
|
167 |
-
<input type="submit" name="Submit" class="button-primary" value="<?php
|
168 |
</p>
|
169 |
|
170 |
<?php wp_nonce_field('cpto_form_submit','cpto_form_nonce'); ?>
|
37 |
|
38 |
$options['navigation_sort_apply'] = isset($_POST['navigation_sort_apply']) ? intval($_POST['navigation_sort_apply']) : '';
|
39 |
|
40 |
+
echo '<div class="updated fade"><p>' . esc_html__('Settings Saved', 'post-types-order') . '</p></div>';
|
41 |
|
42 |
update_option('cpto_options', $options);
|
43 |
update_option('CPT_configured', 'TRUE');
|
54 |
?>
|
55 |
<div id="cpto" class="wrap">
|
56 |
<div id="icon-settings" class="icon32"></div>
|
57 |
+
<h2><?php esc_html_e('General Settings', 'post-types-order') ?></h2>
|
58 |
|
59 |
<?php $this->CPTO->functions->cpt_info_box(); ?>
|
60 |
|
61 |
<form id="form_data" name="form" method="post">
|
62 |
<br />
|
63 |
+
<h2 class="subtitle"><?php esc_html_e('General', 'post-types-order') ?></h2>
|
64 |
<table class="form-table">
|
65 |
<tbody>
|
66 |
<tr valign="top">
|
67 |
+
<th scope="row" style="text-align: right;"><label><?php esc_html_e('Show / Hide re-order interface', 'post-types-order') ?></label></th>
|
68 |
<td>
|
69 |
<?php
|
70 |
|
90 |
continue;
|
91 |
?>
|
92 |
<p><label>
|
93 |
+
<select name="show_reorder_interfaces[<?php echo esc_attr($post_type_name) ?>]">
|
94 |
+
<option value="show" <?php if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] == 'show') {echo ' selected="selected"';} ?>><?php esc_html_e( "Show", 'post-types-order' ) ?></option>
|
95 |
+
<option value="hide" <?php if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] == 'hide') {echo ' selected="selected"';} ?>><?php esc_html_e( "Hide", 'post-types-order' ) ?></option>
|
96 |
+
</select> <?php echo esc_html ( $post_type_data->labels->singular_name ); ?>
|
97 |
</label><br /> </p>
|
98 |
<?php } ?>
|
99 |
</td>
|
100 |
</tr>
|
101 |
<tr valign="top">
|
102 |
+
<th scope="row" style="text-align: right;"><label><?php esc_html_e('Minimum Level to use this plugin', 'post-types-order') ?></label></th>
|
103 |
<td>
|
104 |
<select id="role" name="capability">
|
105 |
+
<option value="read" <?php if (isset($options['capability']) && $options['capability'] == "read") echo 'selected="selected"'?>><?php esc_html_e('Subscriber', 'post-types-order') ?></option>
|
106 |
+
<option value="edit_posts" <?php if (isset($options['capability']) && $options['capability'] == "edit_posts") echo 'selected="selected"'?>><?php esc_html_e('Contributor', 'post-types-order') ?></option>
|
107 |
+
<option value="publish_posts" <?php if (isset($options['capability']) && $options['capability'] == "publish_posts") echo 'selected="selected"'?>><?php esc_html_e('Author', 'post-types-order') ?></option>
|
108 |
+
<option value="publish_pages" <?php if (isset($options['capability']) && $options['capability'] == "publish_pages") echo 'selected="selected"'?>><?php esc_html_e('Editor', 'post-types-order') ?></option>
|
109 |
+
<option value="manage_options" <?php if (!isset($options['capability']) || empty($options['capability']) || (isset($options['capability']) && $options['capability'] == "manage_options")) echo 'selected="selected"'?>><?php esc_html_e('Administrator', 'post-types-order') ?></option>
|
110 |
<?php do_action('pto/admin/plugin_options/capability') ?>
|
111 |
</select>
|
112 |
</td>
|
113 |
</tr>
|
114 |
|
115 |
<tr valign="top">
|
116 |
+
<th scope="row" style="text-align: right;"><label for="autosort"><?php esc_html_e('Auto Sort', 'post-types-order') ?></label></th>
|
117 |
<td>
|
118 |
+
<p><input type="checkbox" <?php checked( '1', $options['autosort'] ); ?> id="autosort" value="1" name="autosort"> <?php esc_html_e("If checked, the plug-in automatically update the WordPress queries to use the new order (<b>No code update is necessarily</b>)", 'post-types-order'); ?></p>
|
119 |
+
<p class="description"><?php esc_html_e("If only certain queries need to use the custom sort, keep this unchecked and include 'orderby' => 'menu_order' into query parameters", 'post-types-order') ?>.
|
120 |
<br />
|
121 |
+
<a href="http://www.nsp-code.com/sample-code-on-how-to-apply-the-sort-for-post-types-order-plugin/" target="_blank"><?php esc_html_e('Additional Description and Examples', 'post-types-order') ?></a></p>
|
122 |
|
123 |
</td>
|
124 |
</tr>
|
125 |
|
126 |
|
127 |
<tr valign="top">
|
128 |
+
<th scope="row" style="text-align: right;"><label for="adminsort"><?php esc_html_e('Admin Sort', 'post-types-order') ?></label></th>
|
129 |
<td>
|
130 |
<p>
|
131 |
<input type="checkbox" <?php checked( '1', $options['adminsort'] ); ?> id="adminsort" value="1" name="adminsort">
|
132 |
+
<?php esc_html_e("To affect the admin interface, to see the post types per your new sort, this need to be checked", 'post-types-order') ?>.</p>
|
133 |
</td>
|
134 |
</tr>
|
135 |
|
136 |
<tr valign="top">
|
137 |
+
<th scope="row" style="text-align: right;"><label for="archive_drag_drop"><?php esc_html_e('Use query ASC / DESC parameter ', 'post-types-order') ?></label></th>
|
138 |
<td>
|
139 |
<p>
|
140 |
<input type="checkbox" <?php checked( '1', $options['use_query_ASC_DESC'] ); ?> id="use_query_ASC_DESC" value="1" name="use_query_ASC_DESC">
|
141 |
+
<?php esc_html_e("If the query include an Ascending or Descending order paramether, use that. If query order is set to DESC the order will be reversed.", 'post-types-order') ?>.</p>
|
142 |
</td>
|
143 |
</tr>
|
144 |
|
145 |
<tr valign="top">
|
146 |
+
<th scope="row" style="text-align: right;"><label for="archive_drag_drop"><?php esc_html_e('Archive Drag&Drop ', 'post-types-order') ?></label></th>
|
147 |
<td>
|
148 |
<p>
|
149 |
<input type="checkbox" <?php checked( '1', $options['archive_drag_drop'] ); ?> id="archive_drag_drop" value="1" name="archive_drag_drop">
|
150 |
+
<?php esc_html_e("Allow sortable drag & drop functionality within default WordPress post type archive. Admin Sort need to be active.", 'post-types-order') ?>.</p>
|
151 |
</td>
|
152 |
</tr>
|
153 |
|
154 |
<tr valign="top">
|
155 |
+
<th scope="row" style="text-align: right;"><label for="navigation_sort_apply"><?php esc_html_e('Next / Previous Apply', 'post-types-order') ?></label></th>
|
156 |
<td>
|
157 |
<p>
|
158 |
<input type="checkbox" <?php checked( '1', $options['navigation_sort_apply'] ); ?> id="navigation_sort_apply" value="1" name="navigation_sort_apply">
|
159 |
+
<?php esc_html_e("Apply the sort on Next / Previous site-wide navigation.", 'post-types-order') ?> <?php esc_html_e('This can also be controlled through', 'post-types-order') ?> <a href="http://www.nsp-code.com/apply-custom-sorting-for-next-previous-site-wide-navigation/" target="_blank"><?php esc_html_e('code', 'post-types-order') ?></a></p>
|
160 |
</td>
|
161 |
</tr>
|
162 |
|
164 |
</table>
|
165 |
|
166 |
<p class="submit">
|
167 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php esc_html_e('Save Settings', 'post-types-order') ?>">
|
168 |
</p>
|
169 |
|
170 |
<?php wp_nonce_field('cpto_form_submit','cpto_form_nonce'); ?>
|
include/class.walkers.php
CHANGED
@@ -35,12 +35,14 @@
|
|
35 |
extract($args, EXTR_SKIP);
|
36 |
|
37 |
$item_details = apply_filters( 'the_title', $page->post_title, $page->ID );
|
38 |
-
$item_details = apply_filters('cpto/interface_itme_data', $item_details, $page);
|
39 |
-
|
40 |
-
$output .= $indent . '<li id="item_'.$page->ID.'"><span>'. $item_details .'</span>';
|
41 |
|
|
|
|
|
42 |
|
|
|
43 |
|
|
|
|
|
44 |
}
|
45 |
|
46 |
|
35 |
extract($args, EXTR_SKIP);
|
36 |
|
37 |
$item_details = apply_filters( 'the_title', $page->post_title, $page->ID );
|
|
|
|
|
|
|
38 |
|
39 |
+
//Deprecated, rely on pto/interface_itme_data
|
40 |
+
$item_details = apply_filters('cpto/interface_itme_data', $item_details, $page);
|
41 |
|
42 |
+
$item_details = apply_filters('pto/interface_item_data', $item_details, $page);
|
43 |
|
44 |
+
$output .= $indent . '<li id="item_'.$page->ID.'"><span>'. $item_details .'</span>';
|
45 |
+
|
46 |
}
|
47 |
|
48 |
|
post-types-order.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.nsp-code.com
|
|
5 |
Description: Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability
|
6 |
Author: Nsp Code
|
7 |
Author URI: http://www.nsp-code.com
|
8 |
-
Version: 1.9.
|
9 |
Text Domain: post-types-order
|
10 |
Domain Path: /languages/
|
11 |
*/
|
5 |
Description: Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability
|
6 |
Author: Nsp Code
|
7 |
Author URI: http://www.nsp-code.com
|
8 |
+
Version: 1.9.4.1
|
9 |
Text Domain: post-types-order
|
10 |
Domain Path: /languages/
|
11 |
*/
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: nsp-code, tdgu
|
|
3 |
Donate link: http://www.nsp-code.com/donate.php
|
4 |
Tags: post order, posts order, sort, post sort, posts sort, post type order, custom order, admin posts order
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.9.
|
8 |
|
9 |
Post Order and custom Post Type Objects (custom post types) using a Drag and Drop Sortable JavaScript AJAX interface or default WordPress dashboard.
|
10 |
|
@@ -65,7 +65,7 @@ Unlike many other plugins, you don't have to do any code changes to make your po
|
|
65 |
|
66 |
= How to manually apply the sort on queries =
|
67 |
|
68 |
-
Include a 'orderby' => 'menu_order' property within your custom query.
|
69 |
|
70 |
= What kind of posts/pages this plugin allow me to sort? =
|
71 |
|
@@ -94,6 +94,11 @@ Consider upgrading to our advanced version of this plugin at a very resonable pr
|
|
94 |
|
95 |
== Change Log ==
|
96 |
|
|
|
|
|
|
|
|
|
|
|
97 |
= 1.9.3.9 =
|
98 |
- Ignore sorting when doing Search and there's a search key-phrase specified.
|
99 |
- Ignore sorting when doing Search within admin dashboard
|
3 |
Donate link: http://www.nsp-code.com/donate.php
|
4 |
Tags: post order, posts order, sort, post sort, posts sort, post type order, custom order, admin posts order
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 5.2
|
7 |
+
Stable tag: 1.9.4.1
|
8 |
|
9 |
Post Order and custom Post Type Objects (custom post types) using a Drag and Drop Sortable JavaScript AJAX interface or default WordPress dashboard.
|
10 |
|
65 |
|
66 |
= How to manually apply the sort on queries =
|
67 |
|
68 |
+
Include a 'orderby' => 'menu_order' property within your custom query arguments.
|
69 |
|
70 |
= What kind of posts/pages this plugin allow me to sort? =
|
71 |
|
94 |
|
95 |
== Change Log ==
|
96 |
|
97 |
+
= 1.9.4.1 =
|
98 |
+
- Ignore the Events Calendar posts
|
99 |
+
- Filter typo fix
|
100 |
+
-
|
101 |
+
|
102 |
= 1.9.3.9 =
|
103 |
- Ignore sorting when doing Search and there's a search key-phrase specified.
|
104 |
- Ignore sorting when doing Search within admin dashboard
|