ba4770c9 by Jeff Balicki

post order

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 404e4df6
1 <?php
2
3 /**
4 * Compatibility : LiteSpeed Cache
5 * Introduced at :
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10 class PTO_LiteSpeed_Cache
11 {
12
13 function __construct()
14 {
15 if( ! $this->is_plugin_active())
16 return FALSE;
17
18 add_action( 'PTO/order_update_complete', array( $this, 'order_update_complete') );
19 }
20
21
22 function is_plugin_active()
23 {
24 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
25
26 if ( is_plugin_active( 'litespeed-cache/litespeed-cache.php' ) )
27 return TRUE;
28 else
29 return FALSE;
30 }
31
32 function order_update_complete()
33 {
34
35 if( method_exists( 'LiteSpeed_Cache_API', 'purge_all' ) )
36 {
37 LiteSpeed_Cache_API::purge_all() ;
38 }
39
40 }
41
42 }
43
44 new PTO_LiteSpeed_Cache();
45
46
47 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3
4 /**
5 * Compatibility : Events Calendar
6 * Introduced at :
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
11 class PTO_Events_calendar
12 {
13
14 function __construct()
15 {
16
17 add_filter( 'pto/posts_orderby/ignore', array ( $this, 'ignore_post_types_order_sort' ), 10, 3 );
18 }
19
20
21 function ignore_post_types_order_sort( $ignore, $orderBy, $query )
22 {
23 if ( isset($query->query_vars) && !empty( $query->query_vars['post_type'] ))
24 {
25 $query_post_types = array();
26 foreach ( (array)$query->query_vars['post_type'] as $_post_type )
27 {
28 $query_post_types[] = $_post_type;
29 }
30
31 if ( in_array("tribe_events", $query_post_types ) )
32 $ignore = TRUE;
33
34 }
35
36 return $ignore;
37 }
38
39 }
40
41 new PTO_Events_calendar();
42
43
44
45 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 /**
4 * Compatibility : Endfold
5 * Introduced at : 5.6.2
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10 class PTO_Enfold
11 {
12
13 function __construct()
14 {
15
16 add_filter( 'pto/posts_orderby/ignore', array ( $this, 'ignore_post_types_order_sort' ), 10, 3 );
17 }
18
19
20 function ignore_post_types_order_sort( $ignore, $orderBy, $query )
21 {
22 if ( isset($query->query_vars) && !empty( $query->query_vars['post_type'] ))
23 {
24 $query_post_types = array();
25 foreach ( (array)$query->query_vars['post_type'] as $_post_type )
26 {
27 $query_post_types[] = $_post_type;
28 }
29
30 if ( in_array("avia_framework_post", $query_post_types ) )
31 $ignore = TRUE;
32 }
33
34 return $ignore;
35 }
36
37 }
38
39 new PTO_Enfold();
40
41
42 ?>
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "name" : "nsp-code/post-types-order",
3 "description" : "Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability",
4 "keywords" : ["post order" , "posts order", "sort", "post sort", "posts sort", "post type order", "custom order", "admin posts order"],
5 "homepage" : "http://www.nsp-code.com/",
6 "authors" : [
7 {
8 "name": "Nsp Code",
9 "email": "contact@nsp-code.com",
10 "homepage": "http://www.nsp-code.com/"
11 }
12 ],
13 "type" : "wordpress-plugin",
14 "repositories" :[
15 {
16 "type":"composer",
17 "url":"https://wpackagist.org",
18 "only": [
19 "wpackagist-plugin/*",
20 "wpackagist-theme/*"
21 ]
22 }
23 ],
24 "require" : {
25 "composer/installers": "~1.0"
26 }
27 }
1 #the-list.ui-sortable tr .check-column:hover { cursor: move;}
2 #the-list.ui-sortable tr.alternate { background-color: #F9F9F9; }
3 #the-list.ui-sortable tr.ui-sortable-helper { background-color: #ffffff; outline: 1px solid #dfdfdf;}
4 #the-list.ui-sortable .ui-sortable-placeholder td{border-color:#bbb;background-color:#FCFCFC; height:32px; background-image: none; -moz-border-radius: 6px 6px 6px 6px; border: 3px dashed #E6E6E6; -webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px; box-sizing: border-box;}
5
6
7 #the-list.ui-sortable > tr > th:first-child:after {position: absolute; color: #959595; content: "\f475"; transform: rotate(-90deg); margin: 4px 0 0 6px; display: block; font-family: dashicons;
8 line-height: 1;
9 font-weight: 400;
10 font-style: normal;
11 text-transform: none;
12 text-rendering: auto;
13 font-size: 20px;
14 text-align: center;}
...\ No newline at end of file ...\ No newline at end of file
1 #form_data td {vertical-align: top; padding-top: 20px}
2 #cpto #cpt_info_box {padding: 0 10px; border: 1px dashed #6aadcc; background-color: #FFF; margin-top: 10px;-webkit-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);-moz-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);}
3 #cpto #cpt_info_box a {text-decoration: none}
4 #cpto #cpt_info_box #donate_form { padding: 20px 0 17px; text-align: center; width: 100%;}
...\ No newline at end of file ...\ No newline at end of file
1 #order-post-type #sortable { list-style-type: none; margin: 10px 0 0; padding: 0; width: 100%; }
2 #order-post-type #sortable ul { margin-left:20px; list-style: none; }
3 #order-post-type #sortable li { padding: 10px; margin: 3px 0px; border-bottom: 1px solid #f4f4f4;border-left: 4px solid #ccd0d4; cursor: move; background-color: #FFF}
4 #order-post-type #sortable li:nth-child(2n+1) { background-color: #f9f9f9 !important;}
5 #order-post-type #sortable li span { display: block; font-size:14px;}
6 #order-post-type #sortable li.placeholder{border: dashed 2px #ccc;height:18px; background-color: #FFF;}
7
8 #cpto h2.subtitle {font-size: 15px; font-style: italic; font-weight: bold; padding-left: 0px}
9 .wrap .example { color: #666666; font-size: 11px; font-weight: bold}
10
11
12 #cpto #cpt_info_box {padding: 0 10px; border: 1px dashed #6aadcc; background-color: #FFF; margin-top: 10px;-webkit-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);-moz-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);}
13 #cpto #cpt_info_box a {text-decoration: none}
14 #cpto #cpt_info_box #donate_form { padding: 20px 0 17px; text-align: center; width: 100%;}
15 .menu_pto {margin-right: 4px; display: inline; vertical-align: middle; margin-top: -1px;}
16
17 #cpto #p_right {float: right; background-color:#f5f5f5; border: 1px dashed #6aadcc; padding: 0px 10px; margin-top: 10px}
18 #cpto .p_s_item {float: right; padding: 0px 5px; margin-top: 10px; margin-bottom: 5px; }
19
20 .clear {clear: both}
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
3 "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4 <svg version="1.0" xmlns="http://www.w3.org/2000/svg"
5 width="11.000000pt" height="29.000000pt" viewBox="0 0 11.000000 29.000000"
6 preserveAspectRatio="xMidYMid meet">
7
8 <g transform="translate(0.000000,29.000000) scale(0.100000,-0.100000)"
9 fill="#000000" stroke="none">
10 <path d="M17 272 c-14 -15 -17 -40 -17 -129 0 -129 10 -147 77 -140 l38 4 -41
11 1 c-22 1 -45 7 -52 14 -17 17 -17 232 1 246 7 6 30 12 52 15 l40 4 -41 1 c-29
12 1 -46 -4 -57 -16z"/>
13 <path d="M30 245 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0
14 -15 -7 -15 -15z"/>
15 <path d="M70 245 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0
16 -15 -7 -15 -15z"/>
17 <path d="M30 195 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0
18 -15 -7 -15 -15z"/>
19 <path d="M70 195 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0
20 -15 -7 -15 -15z"/>
21 <path d="M30 145 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0
22 -15 -7 -15 -15z"/>
23 <path d="M70 145 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0
24 -15 -7 -15 -15z"/>
25 <path d="M30 95 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0 -15
26 -7 -15 -15z"/>
27 <path d="M70 95 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0 -15
28 -7 -15 -15z"/>
29 <path d="M30 45 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0 -15
30 -7 -15 -15z"/>
31 <path d="M70 45 c0 -8 7 -15 15 -15 8 0 15 7 15 15 0 8 -7 15 -15 15 -8 0 -15
32 -7 -15 -15z"/>
33 </g>
34 </svg>
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 class CPT_Compatibility
6 {
7
8 function __construct()
9 {
10
11 $this->init();
12
13 }
14
15
16
17 function init()
18 {
19
20 $CompatibilityFiles = array(
21 'the-events-calendar.php',
22 'LiteSpeed_Cache.php',
23
24 );
25 foreach( $CompatibilityFiles as $CompatibilityFile )
26 {
27 if ( is_file( CPTPATH . 'compatibility/' . $CompatibilityFile ) )
28 include_once( CPTPATH . 'compatibility/' . $CompatibilityFile );
29 }
30
31 /**
32 * Themes
33 */
34
35 $theme = wp_get_theme();
36
37 if( ! $theme instanceof WP_Theme )
38 return FALSE;
39
40 $compatibility_themes = array(
41 'enfold' => 'enfold.php',
42 );
43
44 if (isset( $theme->template ) )
45 {
46 foreach ( $compatibility_themes as $theme_slug => $compatibility_file )
47 {
48 if ( strtolower( $theme->template ) == $theme_slug || strtolower( $theme->name ) == $theme_slug )
49 {
50 include_once( CPTPATH . 'compatibility/themes/' . $compatibility_file );
51 }
52 }
53 }
54
55
56 do_action('cpt/compatibility/init');
57
58 }
59
60
61
62 }
63
64
65 new CPT_Compatibility();
66
67 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 class CPTO
6 {
7 var $current_post_type = null;
8
9 var $functions;
10
11 function __construct()
12 {
13
14 $this->functions = new CptoFunctions();
15
16 $is_configured = get_option('CPT_configured');
17 if ($is_configured == '')
18 add_action( 'admin_notices', array($this, 'admin_configure_notices'));
19
20
21 add_filter('init', array($this, 'on_init'));
22 add_filter('init', array($this, 'compatibility'));
23
24
25 add_filter('pre_get_posts', array($this, 'pre_get_posts'));
26 add_filter('posts_orderby', array($this, 'posts_orderby'), 99, 2);
27 }
28
29
30 function init()
31 {
32
33 include_once(CPTPATH . '/include/class.walkers.php');
34
35 //add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
36 add_action( 'admin_init', array(&$this, 'admin_init'), 10 );
37 add_action( 'admin_menu', array(&$this, 'addMenu') );
38
39 add_action('admin_menu', array(&$this, 'plugin_options_menu'));
40
41 //load archive drag&drop sorting dependencies
42 add_action( 'admin_enqueue_scripts', array(&$this, 'archiveDragDrop'), 10 );
43
44 add_action( 'wp_ajax_update-custom-type-order', array(&$this, 'saveAjaxOrder') );
45 add_action( 'wp_ajax_update-custom-type-order-archive', array(&$this, 'saveArchiveAjaxOrder') );
46
47
48 }
49
50
51 /**
52 * On WordPress Init hook
53 * This is being used to set the navigational links
54 *
55 */
56 function on_init()
57 {
58 if( is_admin() )
59 return;
60
61
62 //check the navigation_sort_apply option
63 $options = $this->functions->get_options();
64
65 $navigation_sort_apply = ($options['navigation_sort_apply'] == "1") ? TRUE : FALSE;
66
67 //Deprecated, rely on pto/navigation_sort_apply
68 $navigation_sort_apply = apply_filters('cpto/navigation_sort_apply', $navigation_sort_apply);
69
70 $navigation_sort_apply = apply_filters('pto/navigation_sort_apply', $navigation_sort_apply);
71
72 if( ! $navigation_sort_apply)
73 return;
74
75 add_filter('get_previous_post_where', array($this->functions, 'cpto_get_previous_post_where'), 99, 3);
76 add_filter('get_previous_post_sort', array($this->functions, 'cpto_get_previous_post_sort') );
77 add_filter('get_next_post_where', array($this->functions, 'cpto_get_next_post_where'), 99, 3);
78 add_filter('get_next_post_sort', array($this->functions, 'cpto_get_next_post_sort') );
79
80 }
81
82
83 /**
84 * Compatibility with different 3rd codes
85 *
86 */
87 function compatibility()
88 {
89 include_once( CPTPATH . '/include/class.compatibility.php');
90 }
91
92
93
94 function pre_get_posts($query)
95 {
96
97 //no need if it's admin interface
98 if (is_admin())
99 return $query;
100
101 //check for ignore_custom_sort
102 if (isset($query->query_vars['ignore_custom_sort']) && $query->query_vars['ignore_custom_sort'] === TRUE)
103 return $query;
104
105 //ignore if "nav_menu_item"
106 if(isset($query->query_vars) && isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == "nav_menu_item")
107 return $query;
108
109 $options = $this->functions->get_options();
110
111 //if auto sort
112 if ($options['autosort'] == "1")
113 {
114 //remove the supresed filters;
115 if (isset($query->query['suppress_filters']))
116 $query->query['suppress_filters'] = FALSE;
117
118
119 if (isset($query->query_vars['suppress_filters']))
120 $query->query_vars['suppress_filters'] = FALSE;
121
122 }
123
124 return $query;
125 }
126
127
128
129 function posts_orderby($orderBy, $query)
130 {
131 global $wpdb;
132
133 $options = $this->functions->get_options();
134
135 //check for ignore_custom_sort
136 if (isset($query->query_vars['ignore_custom_sort']) && $query->query_vars['ignore_custom_sort'] === TRUE)
137 return $orderBy;
138
139 //ignore the bbpress
140 if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("reply", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "reply")))
141 return $orderBy;
142 if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("topic", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "topic")))
143 return $orderBy;
144
145 //check for orderby GET paramether in which case return default data
146 if (isset($_GET['orderby']) && $_GET['orderby'] != 'menu_order')
147 return $orderBy;
148
149 //Avada orderby
150 if (isset($_GET['product_orderby']) && $_GET['product_orderby'] != 'default')
151 return $orderBy;
152
153 //check to ignore
154 /**
155 * Deprecated filter
156 * do not rely on this anymore
157 */
158 if(apply_filters('pto/posts_orderby', $orderBy, $query) === FALSE)
159 return $orderBy;
160
161 $ignore = apply_filters('pto/posts_orderby/ignore', FALSE, $orderBy, $query);
162 if($ignore === TRUE)
163 return $orderBy;
164
165 //ignore search
166 if( $query->is_search() && isset( $query->query['s'] ) && ! empty ( $query->query['s'] ) )
167 return( $orderBy );
168
169 if ( ( is_admin() && !wp_doing_ajax() ) || ( wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments') )
170 {
171
172 if ( $options['adminsort'] == "1" || ( wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments') )
173 {
174
175 global $post;
176
177 $order = apply_filters('pto/posts_order', '', $query);
178
179 //temporary ignore ACF group and admin ajax calls, should be fixed within ACF plugin sometime later
180 if (is_object($post) && $post->post_type == "acf-field-group"
181 || (defined('DOING_AJAX') && isset($_REQUEST['action']) && strpos($_REQUEST['action'], 'acf/') === 0))
182 return $orderBy;
183
184 if(isset($_POST['query']) && isset($_POST['query']['post__in']) && is_array($_POST['query']['post__in']) && count($_POST['query']['post__in']) > 0)
185 return $orderBy;
186
187 $orderBy = "{$wpdb->posts}.menu_order {$order}, {$wpdb->posts}.post_date DESC";
188 }
189 }
190 else
191 {
192 $order = '';
193 if ($options['use_query_ASC_DESC'] == "1")
194 $order = isset($query->query_vars['order']) ? " " . $query->query_vars['order'] : '';
195
196 $order = apply_filters('pto/posts_order', $order, $query);
197
198 if ($options['autosort'] == "1")
199 {
200 if(trim($orderBy) == '')
201 $orderBy = "{$wpdb->posts}.menu_order " . $order;
202 else
203 $orderBy = "{$wpdb->posts}.menu_order". $order .", " . $orderBy;
204 }
205 }
206
207 return($orderBy);
208 }
209
210
211
212 /**
213 * Show not configured notive
214 *
215 */
216 function admin_configure_notices()
217 {
218 if (isset($_POST['form_submit']))
219 return;
220
221 ?>
222 <div class="error fade">
223 <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>
224 </div>
225 <?php
226 }
227
228
229 /**
230 * Plugin options menu
231 *
232 */
233 function plugin_options_menu()
234 {
235
236 include (CPTPATH . '/include/class.options.php');
237
238 $options_interface = new CptoOptionsInterface();
239 $options_interface->check_options_update();
240
241 $hookID = add_options_page('Post Types Order', '<img class="menu_pto" src="'. CPTURL .'/images/menu-icon.png" alt="" /> Post Types Order', 'manage_options', 'cpto-options', array($options_interface, 'plugin_options_interface'));
242 add_action('admin_print_styles-' . $hookID , array($this, 'admin_options_print_styles'));
243 }
244
245 function admin_options_print_styles()
246 {
247 wp_register_style('pto-options', CPTURL . '/css/cpt-options.css');
248 wp_enqueue_style( 'pto-options');
249 }
250
251
252 /**
253 * Load archive drag&drop sorting dependencies
254 *
255 * Since version 1.8.8
256 */
257 function archiveDragDrop()
258 {
259 $options = $this->functions->get_options();
260
261
262 //if adminsort turned off no need to continue
263 if( $options['adminsort'] != '1')
264 return;
265
266 $screen = get_current_screen();
267
268 //check if the right interface
269 if( !isset( $screen->post_type ) || empty($screen->post_type))
270 return;
271
272 if( isset( $screen->taxonomy ) && !empty($screen->taxonomy) )
273 return;
274
275 if ( empty ( $options['allow_reorder_default_interfaces'][$screen->post_type] ) || ( isset ( $options['allow_reorder_default_interfaces'][$screen->post_type] ) && $options['allow_reorder_default_interfaces'][$screen->post_type] != 'yes' ) )
276 return;
277
278 if ( wp_is_mobile() )
279 return;
280
281 //check if post type is sortable
282 if(isset($options['show_reorder_interfaces'][$screen->post_type]) && $options['show_reorder_interfaces'][ $screen->post_type ] != 'show')
283 return;
284
285 //not for hierarhical
286 //if ( is_post_type_hierarchical( $screen->post_type ) )
287 //return;
288
289 //if is taxonomy term filter return
290 if(is_category() || is_tax())
291 return;
292
293 //return if use orderby columns
294 if (isset($_GET['orderby']) && $_GET['orderby'] != 'menu_order')
295 return false;
296
297 //return if post status filtering
298 if (isset($_GET['post_status']))
299 return false;
300
301 //return if post author filtering
302 if (isset($_GET['author']))
303 return false;
304
305 //load required dependencies
306 wp_enqueue_style('cpt-archive-dd', CPTURL . '/css/cpt-archive-dd.css');
307
308 wp_enqueue_script('jquery');
309 wp_enqueue_script('jquery-ui-sortable');
310 wp_register_script('cpto', CPTURL . '/js/cpt.js', array('jquery'));
311
312 global $userdata;
313
314 // Localize the script with new data
315 $CPTO_variables = array(
316 'post_type' => $screen->post_type,
317 'archive_sort_nonce' => wp_create_nonce( 'CPTO_archive_sort_nonce_' . $userdata->ID)
318 );
319 wp_localize_script( 'cpto', 'CPTO', $CPTO_variables );
320
321 // Enqueued script with localized data.
322 wp_enqueue_script( 'cpto' );
323
324 }
325
326
327
328 function admin_init()
329 {
330 if ( isset($_GET['page']) && substr($_GET['page'], 0, 17) == 'order-post-types-' )
331 {
332 $this->current_post_type = get_post_type_object(str_replace( 'order-post-types-', '', $_GET['page'] ));
333 if ( $this->current_post_type == null)
334 {
335 wp_die('Invalid post type');
336 }
337 }
338
339 //add compatibility filters and code
340 include_once(CPTPATH . '/compatibility/LiteSpeed_Cache.php');
341
342 }
343
344
345 /**
346 * Save the order set through separate interface
347 *
348 */
349 function saveAjaxOrder()
350 {
351
352 set_time_limit(600);
353
354 global $wpdb;
355
356 $nonce = $_POST['interface_sort_nonce'];
357
358 //verify the nonce
359 if (! wp_verify_nonce( $nonce, 'interface_sort_nonce') )
360 die();
361
362 parse_str($_POST['order'], $data);
363
364 if (is_array($data))
365 {
366 foreach($data as $key => $values )
367 {
368 if ( $key == 'item' )
369 {
370 foreach( $values as $position => $id )
371 {
372
373 //sanitize
374 $id = (int)$id;
375
376 $data = array('menu_order' => $position);
377
378 //Deprecated, rely on pto/save-ajax-order
379 $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
380
381 $data = apply_filters('pto/save-ajax-order', $data, $key, $id);
382
383 $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
384 }
385 }
386 else
387 {
388 foreach( $values as $position => $id )
389 {
390
391 //sanitize
392 $id = (int)$id;
393
394 $data = array('menu_order' => $position, 'post_parent' => str_replace('item_', '', $key));
395
396 //Deprecated, rely on pto/save-ajax-order
397 $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
398
399 $data = apply_filters('pto/save-ajax-order', $data, $key, $id);
400
401 $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
402 }
403 }
404 }
405
406 }
407
408 //trigger action completed
409 do_action('PTO/order_update_complete');
410
411 wp_cache_flush();
412 }
413
414
415 /**
416 * Save the order set throgh the Archive
417 *
418 */
419 function saveArchiveAjaxOrder()
420 {
421
422 set_time_limit(600);
423
424 global $wpdb, $userdata;
425
426 $post_type = filter_var ( $_POST['post_type'], FILTER_SANITIZE_STRING);
427 $paged = filter_var ( $_POST['paged'], FILTER_SANITIZE_NUMBER_INT);
428 $nonce = $_POST['archive_sort_nonce'];
429
430 //verify the nonce
431 if (! wp_verify_nonce( $nonce, 'CPTO_archive_sort_nonce_' . $userdata->ID ) )
432 die();
433
434 parse_str($_POST['order'], $data);
435
436 if (!is_array($data) || count($data) < 1)
437 die();
438
439 //retrieve a list of all objects
440 $mysql_query = $wpdb->prepare("SELECT ID FROM ". $wpdb->posts ."
441 WHERE post_type = %s AND post_status IN ('publish', 'pending', 'draft', 'private', 'future', 'inherit')
442 ORDER BY menu_order, post_date DESC", $post_type);
443 $results = $wpdb->get_results($mysql_query);
444
445 if (!is_array($results) || count($results) < 1)
446 die();
447
448 //create the list of ID's
449 $objects_ids = array();
450 foreach($results as $result)
451 {
452 $objects_ids[] = (int)$result->ID;
453 }
454
455 global $userdata;
456 $objects_per_page = get_user_meta($userdata->ID ,'edit_' . $post_type .'_per_page', TRUE);
457 $objects_per_page = apply_filters( "edit_{$post_type}_per_page", $objects_per_page );
458 if(empty($objects_per_page))
459 $objects_per_page = 20;
460
461 $edit_start_at = $paged * $objects_per_page - $objects_per_page;
462 $index = 0;
463 for($i = $edit_start_at; $i < ($edit_start_at + $objects_per_page); $i++)
464 {
465 if(!isset($objects_ids[$i]))
466 break;
467
468 $objects_ids[$i] = (int)$data['post'][$index];
469 $index++;
470 }
471
472 //update the menu_order within database
473 foreach( $objects_ids as $menu_order => $id )
474 {
475 $data = array(
476 'menu_order' => $menu_order
477 );
478
479 //Deprecated, rely on pto/save-ajax-order
480 $data = apply_filters('post-types-order_save-ajax-order', $data, $menu_order, $id);
481
482 $data = apply_filters('pto/save-ajax-order', $data, $menu_order, $id);
483
484 $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
485
486 clean_post_cache( $id );
487 }
488
489 //trigger action completed
490 do_action('PTO/order_update_complete');
491
492 wp_cache_flush();
493 }
494
495
496 function addMenu()
497 {
498 global $userdata;
499 //put a menu for all custom_type
500 $post_types = get_post_types();
501
502 $options = $this->functions->get_options();
503 //get the required user capability
504 $capability = '';
505 if(isset($options['capability']) && !empty($options['capability']))
506 {
507 $capability = $options['capability'];
508 }
509 else if (is_numeric($options['level']))
510 {
511 $capability = $this->functions->userdata_get_user_level();
512 }
513 else
514 {
515 $capability = 'manage_options';
516 }
517
518 foreach( $post_types as $post_type_name )
519 {
520 if ($post_type_name == 'page')
521 continue;
522
523 //ignore bbpress
524 if ($post_type_name == 'reply' || $post_type_name == 'topic')
525 continue;
526
527 if(is_post_type_hierarchical($post_type_name))
528 continue;
529
530 $post_type_data = get_post_type_object( $post_type_name );
531 if($post_type_data->show_ui === FALSE)
532 continue;
533
534 if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] != 'show')
535 continue;
536
537 $required_capability = apply_filters('pto/edit_capability', $capability, $post_type_name);
538
539 if ( $post_type_name == 'post' )
540 $hookID = 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') );
541 elseif ($post_type_name == 'attachment')
542 $hookID = 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') );
543 else
544 {
545 $hookID = 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') );
546 }
547
548 add_action('admin_print_styles-' . $hookID , array($this, 'admin_reorder_print_styles'));
549 }
550 }
551
552
553 function admin_reorder_print_styles()
554 {
555
556 if ( $this->current_post_type != null )
557 {
558 wp_enqueue_script('jQuery');
559 wp_enqueue_script('jquery-ui-sortable');
560 }
561
562 wp_register_style('CPTStyleSheets', CPTURL . '/css/cpt.css');
563 wp_enqueue_style( 'CPTStyleSheets');
564 }
565
566
567 function SortPage()
568 {
569 ?>
570 <div id="cpto" class="wrap">
571 <div class="icon32" id="icon-edit"><br></div>
572 <h2><?php echo esc_html( $this->current_post_type->labels->singular_name . ' - '. esc_html__('Re-Order', 'post-types-order') ); ?></h2>
573
574 <?php $this->functions->cpt_info_box(); ?>
575
576 <div id="ajax-response"></div>
577
578 <noscript>
579 <div class="error message">
580 <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>
581 </div>
582 </noscript>
583
584 <div id="order-post-type">
585 <ul id="sortable">
586 <?php $this->listPages('hide_empty=0&title_li=&post_type='.$this->current_post_type->name); ?>
587 </ul>
588
589 <div class="clear"></div>
590 </div>
591
592 <p class="submit">
593 <a href="javascript: void(0)" id="save-order" class="button-primary"><?php esc_html_e('Update', 'post-types-order' ); ?></a>
594 </p>
595
596 <?php wp_nonce_field( 'interface_sort_nonce', 'interface_sort_nonce' ); ?>
597
598 <script type="text/javascript">
599 jQuery(document).ready(function() {
600 jQuery("#sortable").sortable({
601 'tolerance':'intersect',
602 'cursor':'pointer',
603 'items':'li',
604 'placeholder':'placeholder',
605 'nested': 'ul'
606 });
607
608 jQuery("#sortable").disableSelection();
609 jQuery("#save-order").bind( "click", function() {
610
611 jQuery("html, body").animate({ scrollTop: 0 }, "fast");
612
613 jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize"), 'interface_sort_nonce' : jQuery('#interface_sort_nonce').val() }, function() {
614 jQuery("#ajax-response").html('<div class="message updated fade"><p><?php esc_html_e('Items Order Updated', 'post-types-order') ?></p></div>');
615 jQuery("#ajax-response div").delay(3000).hide("slow");
616 });
617 });
618 });
619 </script>
620
621 </div>
622 <?php
623 }
624
625 function listPages($args = '')
626 {
627 $defaults = array(
628 'depth' => -1,
629 'date_format' => get_option('date_format'),
630 'child_of' => 0,
631 'sort_column' => 'menu_order',
632 'post_status' => 'any'
633 );
634
635 $r = wp_parse_args( $args, $defaults );
636 extract( $r, EXTR_SKIP );
637
638 $output = '';
639
640 $r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', array()) );
641
642 // Query pages.
643 $r['hierarchical'] = 0;
644 $args = array(
645 'sort_column' => 'menu_order',
646 'post_type' => $post_type,
647 'posts_per_page' => -1,
648 'post_status' => 'any',
649 'orderby' => array(
650 'menu_order' => 'ASC',
651 'post_date' => 'DESC'
652 )
653 );
654
655 $the_query = new WP_Query($args);
656 $pages = $the_query->posts;
657
658 if ( !empty($pages) )
659 {
660 $output .= $this->walkTree($pages, $r['depth'], $r);
661 }
662
663 echo wp_kses_post ( $output );
664 }
665
666 function walkTree($pages, $depth, $r)
667 {
668 $walker = new Post_Types_Order_Walker;
669
670 $args = array($pages, $depth, $r);
671 return call_user_func_array(array(&$walker, 'walk'), $args);
672 }
673 }
674
675
676
677
678 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 class CptoFunctions
6 {
7
8 /**
9 * Return the user level
10 *
11 * This is deprecated, will be removed in the next versions
12 *
13 * @param mixed $return_as_numeric
14 */
15 function userdata_get_user_level($return_as_numeric = FALSE)
16 {
17 global $userdata;
18
19 $user_level = '';
20 for ($i=10; $i >= 0;$i--)
21 {
22 if (current_user_can('level_' . $i) === TRUE)
23 {
24 $user_level = $i;
25 if ($return_as_numeric === FALSE)
26 $user_level = 'level_'.$i;
27 break;
28 }
29 }
30 return ($user_level);
31 }
32
33
34 /**
35 * Retrieve the plugin options
36 *
37 */
38 function get_options()
39 {
40 //make sure the vars are set as default
41 $options = get_option('cpto_options');
42
43 $defaults = array (
44 'show_reorder_interfaces' => array(),
45 'allow_reorder_default_interfaces' => array(),
46 'autosort' => 1,
47 'adminsort' => 1,
48 'use_query_ASC_DESC' => '',
49 'capability' => 'manage_options',
50 'navigation_sort_apply' => 1,
51
52 );
53 $options = wp_parse_args( $options, $defaults );
54
55 $options = apply_filters('pto/get_options', $options);
56
57 return $options;
58 }
59
60
61 /**
62 * General messages box
63 *
64 */
65 function cpt_info_box()
66 {
67 ?>
68 <div id="cpt_info_box">
69 <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="https://www.nsp-code.com/" target="_blank"><strong>https://www.nsp-code.com/</strong></a>.</p>
70 <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="https://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/"><?php _e('Read more', 'post-types-order') ?></a></h4>
71 <p><?php esc_html_e('Check our', 'post-types-order') ?> <a target="_blank" href="https://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>
72 <p><span style="color:#CC0000" class="dashicons dashicons-megaphone" alt="f488">&nbsp;</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('an extra layer of security for your site. The easy way to completely hide your WordPress core files, themes and plugins', 'post-types-order') ?>.</p>
73
74 <div class="clear"></div>
75 </div>
76
77 <?php
78 }
79
80
81
82 function cpto_get_previous_post_where($where, $in_same_term, $excluded_terms)
83 {
84 global $post, $wpdb;
85
86 if ( empty( $post ) )
87 return $where;
88
89 //?? WordPress does not pass through this varialbe, so we presume it's category..
90 $taxonomy = 'category';
91 if(preg_match('/ tt.taxonomy = \'([^\']+)\'/i',$where, $match))
92 $taxonomy = $match[1];
93
94 $_join = '';
95 $_where = '';
96
97 if ( $in_same_term || ! empty( $excluded_terms ) )
98 {
99 $_join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
100 $_where = $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
101
102 if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) )
103 {
104 // back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
105 if ( false !== strpos( $excluded_terms, ' and ' ) )
106 {
107 _deprecated_argument( __FUNCTION__, '3.3', sprintf( esc_html__( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
108 $excluded_terms = explode( ' and ', $excluded_terms );
109 }
110 else
111 {
112 $excluded_terms = explode( ',', $excluded_terms );
113 }
114
115 $excluded_terms = array_map( 'intval', $excluded_terms );
116 }
117
118 if ( $in_same_term )
119 {
120 $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
121
122 // Remove any exclusions from the term array to include.
123 $term_array = array_diff( $term_array, (array) $excluded_terms );
124 $term_array = array_map( 'intval', $term_array );
125
126 $_where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
127 }
128
129 if ( ! empty( $excluded_terms ) ) {
130 $_where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', $excluded_terms ) . ') )';
131 }
132 }
133
134 $current_menu_order = $post->menu_order;
135
136 $query = $wpdb->prepare( "SELECT p.* FROM $wpdb->posts AS p
137 $_join
138 WHERE p.post_date < %s AND p.menu_order = %d AND p.post_type = %s AND p.post_status = 'publish' $_where" , $post->post_date, $current_menu_order, $post->post_type);
139 $results = $wpdb->get_results($query);
140
141 if (count($results) > 0)
142 {
143 $where .= $wpdb->prepare( " AND p.menu_order = %d", $current_menu_order );
144 }
145 else
146 {
147 $where = str_replace("p.post_date < '". $post->post_date ."'", "p.menu_order > '$current_menu_order'", $where);
148 }
149
150 return $where;
151 }
152
153 function cpto_get_previous_post_sort($sort)
154 {
155 global $post, $wpdb;
156
157 $sort = 'ORDER BY p.menu_order ASC, p.post_date DESC LIMIT 1';
158
159 return $sort;
160 }
161
162 function cpto_get_next_post_where($where, $in_same_term, $excluded_terms)
163 {
164 global $post, $wpdb;
165
166 if ( empty( $post ) )
167 return $where;
168
169 $taxonomy = 'category';
170 if(preg_match('/ tt.taxonomy = \'([^\']+)\'/i',$where, $match))
171 $taxonomy = $match[1];
172
173 $_join = '';
174 $_where = '';
175
176 if ( $in_same_term || ! empty( $excluded_terms ) )
177 {
178 $_join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
179 $_where = $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
180
181 if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) )
182 {
183 // back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
184 if ( false !== strpos( $excluded_terms, ' and ' ) )
185 {
186 _deprecated_argument( __FUNCTION__, '3.3', sprintf( esc_html__( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
187 $excluded_terms = explode( ' and ', $excluded_terms );
188 }
189 else
190 {
191 $excluded_terms = explode( ',', $excluded_terms );
192 }
193
194 $excluded_terms = array_map( 'intval', $excluded_terms );
195 }
196
197 if ( $in_same_term )
198 {
199 $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
200
201 // Remove any exclusions from the term array to include.
202 $term_array = array_diff( $term_array, (array) $excluded_terms );
203 $term_array = array_map( 'intval', $term_array );
204
205 $_where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
206 }
207
208 if ( ! empty( $excluded_terms ) ) {
209 $_where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', $excluded_terms ) . ') )';
210 }
211 }
212
213 $current_menu_order = $post->menu_order;
214
215 //check if there are more posts with lower menu_order
216 $query = $wpdb->prepare( "SELECT p.* FROM $wpdb->posts AS p
217 $_join
218 WHERE p.post_date > %s AND p.menu_order = %d AND p.post_type = %s AND p.post_status = 'publish' $_where", $post->post_date, $current_menu_order, $post->post_type );
219 $results = $wpdb->get_results($query);
220
221 if (count($results) > 0)
222 {
223 $where .= $wpdb->prepare(" AND p.menu_order = %d", $current_menu_order );
224 }
225 else
226 {
227 $where = str_replace("p.post_date > '". $post->post_date ."'", "p.menu_order < '$current_menu_order'", $where);
228 }
229
230 return $where;
231 }
232
233 function cpto_get_next_post_sort($sort)
234 {
235 global $post, $wpdb;
236
237 $sort = 'ORDER BY p.menu_order DESC, p.post_date ASC LIMIT 1';
238
239 return $sort;
240 }
241
242
243
244 }
245
246 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 class CptoOptionsInterface
6 {
7
8 var $CPTO;
9
10
11 function __construct()
12 {
13
14 global $CPTO;
15
16 $this->CPTO = $CPTO;
17
18 }
19
20 function check_options_update()
21 {
22
23 $options = $this->CPTO->functions->get_options();
24
25 if (isset($_POST['form_submit']) && wp_verify_nonce($_POST['cpto_form_nonce'],'cpto_form_submit'))
26 {
27
28 $options['show_reorder_interfaces'] = array_map( 'sanitize_key', (array) $_POST['show_reorder_interfaces'] );
29 $options['allow_reorder_default_interfaces'] = array_map( 'sanitize_key', (array) $_POST['allow_reorder_default_interfaces'] );
30
31 $options['capability'] = sanitize_key($_POST['capability']);
32
33 $options['autosort'] = isset($_POST['autosort']) ? intval($_POST['autosort']) : '';
34 $options['adminsort'] = isset($_POST['adminsort']) ? intval($_POST['adminsort']) : '';
35 $options['use_query_ASC_DESC'] = isset($_POST['use_query_ASC_DESC']) ? intval($_POST['use_query_ASC_DESC']) : '';
36
37 $options['navigation_sort_apply'] = isset($_POST['navigation_sort_apply']) ? intval($_POST['navigation_sort_apply']) : '';
38
39 update_option('cpto_options', $options);
40 update_option('CPT_configured', 'TRUE');
41
42 add_action( 'admin_notices', array( $this, 'admin_save_notice') );
43
44 }
45
46 }
47
48
49 function admin_save_notice()
50 {
51
52 echo "<div class='updated'><p>". esc_html__('Settings Saved', 'post-types-order') ."</p></div>";
53
54 }
55
56
57 function plugin_options_interface()
58 {
59 $options = $this->CPTO->functions->get_options();
60
61 ?>
62 <div id="cpto" class="wrap">
63 <h2><?php esc_html_e('General Settings', 'post-types-order') ?></h2>
64
65 <?php $this->CPTO->functions->cpt_info_box(); ?>
66
67 <form id="form_data" name="form" method="post">
68 <br />
69 <h2><?php esc_html_e('General', 'post-types-order') ?></h2>
70 <table class="form-table">
71 <tbody>
72 <tr valign="top">
73 <th scope="row" style="text-align: right;"><label><?php esc_html_e('Show / Hide re-order interface', 'post-types-order') ?></label></th>
74 <td>
75 <?php
76
77 $post_types = get_post_types();
78 foreach( $post_types as $post_type_name )
79 {
80 //ignore list
81 $ignore_post_types = array(
82 'reply',
83 'topic',
84 'report',
85 'status'
86 );
87
88 if( in_array($post_type_name, $ignore_post_types) )
89 continue;
90
91 if( is_post_type_hierarchical($post_type_name) )
92 continue;
93
94 $post_type_data = get_post_type_object( $post_type_name );
95 if($post_type_data->show_ui === FALSE)
96 continue;
97 ?>
98 <p><label>
99 <select name="show_reorder_interfaces[<?php echo esc_attr($post_type_name) ?>]">
100 <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>
101 <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>
102 </select> &nbsp;&nbsp;<?php echo esc_html ( $post_type_data->labels->singular_name ); ?>
103 </label><br />&nbsp;</p>
104 <?php } ?>
105 </td>
106
107 </tr>
108 <tr valign="top">
109 <th scope="row" style="text-align: right;"><label><?php esc_html_e('Minimum Level to use this plugin', 'post-types-order') ?></label></th>
110 <td>
111 <select id="role" name="capability">
112 <option value="read" <?php if (isset($options['capability']) && $options['capability'] == "read") echo 'selected="selected"'?>><?php esc_html_e('Subscriber', 'post-types-order') ?></option>
113 <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>
114 <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>
115 <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>
116 <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>
117 <?php do_action('pto/admin/plugin_options/capability') ?>
118 </select>
119 </td>
120 </tr>
121
122 <tr valign="top">
123 <th scope="row" style="text-align: right;"><label for="autosort"><?php esc_html_e('Auto Sort', 'post-types-order') ?></label></th>
124 <td>
125 <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", 'post-types-order'); ?> ( <b><?php esc_html_e("No code update is necessarily", 'post-types-order'); ?></b> )</p>
126 <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') ?>.
127 <br />
128 <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>
129
130 </td>
131 </tr>
132
133
134 <tr valign="top">
135 <th scope="row" style="text-align: right;"><label for="adminsort"><?php esc_html_e('Admin Sort', 'post-types-order') ?></label></th>
136 <td>
137 <p>
138 <input type="checkbox" <?php checked( '1', $options['adminsort'] ); ?> id="adminsort" value="1" name="adminsort">
139 <?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>
140 </td>
141 </tr>
142
143 <tr valign="top">
144 <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>
145 <td>
146 <p>
147 <input type="checkbox" <?php checked( '1', $options['use_query_ASC_DESC'] ); ?> id="use_query_ASC_DESC" value="1" name="use_query_ASC_DESC">
148 <?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>
149 </td>
150 </tr>
151
152 <tr valign="top">
153 <th scope="row" style="text-align: right;"><label for="archive_drag_drop"><?php esc_html_e('Archive Drag&Drop ', 'post-types-order') ?></label></th>
154 <td>
155 <p>
156 <?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>
157 <br />
158 <?php
159
160 $post_types = get_post_types();
161 foreach( $post_types as $post_type_name )
162 {
163 //ignore list
164 $ignore_post_types = array(
165 'reply',
166 'topic',
167 'report',
168 'status'
169 );
170
171 if( in_array($post_type_name, $ignore_post_types) )
172 continue;
173
174
175 $post_type_data = get_post_type_object( $post_type_name );
176 if($post_type_data->show_ui === FALSE)
177 continue;
178 ?>
179 <p><label>
180 <select name="allow_reorder_default_interfaces[<?php echo esc_attr($post_type_name) ?>]">
181 <option value="no" <?php if(isset($options['allow_reorder_default_interfaces'][$post_type_name]) && $options['allow_reorder_default_interfaces'][$post_type_name] == 'no') {echo ' selected="selected"';} ?>><?php esc_html_e( "No", 'post-types-order' ) ?></option>
182 <option value="yes" <?php if(isset($options['allow_reorder_default_interfaces'][$post_type_name]) && $options['allow_reorder_default_interfaces'][$post_type_name] == 'yes') {echo ' selected="selected"';} ?>><?php esc_html_e( "Yes", 'post-types-order' ) ?></option>
183 </select> &nbsp;&nbsp;<?php echo esc_html ( $post_type_data->labels->singular_name ); ?>
184 </label><br />&nbsp;</p>
185 <?php } ?>
186
187 </td>
188
189 </tr>
190
191 <tr valign="top">
192 <th scope="row" style="text-align: right;"><label for="navigation_sort_apply"><?php esc_html_e('Next / Previous Apply', 'post-types-order') ?></label></th>
193 <td>
194 <p>
195 <input type="checkbox" <?php checked( '1', $options['navigation_sort_apply'] ); ?> id="navigation_sort_apply" value="1" name="navigation_sort_apply">
196 <?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>
197 </td>
198 </tr>
199
200 </tbody>
201 </table>
202
203 <p class="submit">
204 <input type="submit" name="Submit" class="button-primary" value="<?php esc_html_e('Save Settings', 'post-types-order') ?>">
205 </p>
206
207 <?php wp_nonce_field('cpto_form_submit','cpto_form_nonce'); ?>
208 <input type="hidden" name="form_submit" value="true" />
209
210
211 </form>
212
213 </div>
214 <?php
215
216 }
217 }
218
219 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 class Post_Types_Order_Walker extends Walker
6 {
7
8 var $db_fields = array (
9 'parent' => 'post_parent',
10 'id' => 'ID'
11 );
12
13
14 function start_lvl(&$output, $depth = 0, $args = array())
15 {
16 $indent = str_repeat("\t", $depth);
17 $output .= "\n$indent<ul class='children'>\n";
18 }
19
20
21 function end_lvl(&$output, $depth = 0, $args = array())
22 {
23 $indent = str_repeat("\t", $depth);
24 $output .= "$indent</ul>\n";
25 }
26
27
28 function start_el(&$output, $page, $depth = 0, $args = array(), $id = 0)
29 {
30 if ( $depth )
31 $indent = str_repeat("\t", $depth);
32 else
33 $indent = '';
34
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
49 function end_el(&$output, $page, $depth = 0, $args = array())
50 {
51 $output .= "</li>\n";
52 }
53
54 }
55
56
57
58 ?>
...\ No newline at end of file ...\ No newline at end of file
1
2
3 var getUrlParameter = function getUrlParameter(sParam)
4 {
5 var sPageURL = decodeURIComponent(window.location.search.substring(1)),
6 sURLVariables = sPageURL.split('&'),
7 sParameterName,
8 i;
9
10 for (i = 0; i < sURLVariables.length; i++) {
11 sParameterName = sURLVariables[i].split('=');
12
13 if (sParameterName[0] === sParam) {
14 return sParameterName[1] === undefined ? true : sParameterName[1];
15 }
16 }
17 };
18
19 jQuery(document).ready(function()
20 {
21
22 jQuery('table.wp-list-table #the-list').sortable({
23
24 placeholder: {
25 element: function(currentItem) {
26 var cols = jQuery(currentItem).children('td:visible').length + 1;
27 return jQuery('<tr class="ui-sortable-placeholder"><td colspan="' + cols + '">&nbsp;</td></tr>')[0];
28 },
29 update: function(container, p) {
30 return;
31 }
32 },
33
34 'items': 'tr',
35 'handle': ".check-column",
36 'axis': 'y',
37 'update' : function(e, ui) {
38
39 var post_type = CPTO.post_type;
40 var order = jQuery('#the-list').sortable('serialize');
41
42 var paged = getUrlParameter('paged');
43 if(typeof paged === 'undefined')
44 paged = 1;
45
46 var queryString = { "action": "update-custom-type-order-archive", "post_type" : post_type, "order" : order ,"paged": paged, "archive_sort_nonce" : CPTO.archive_sort_nonce};
47 //send the data through ajax
48 jQuery.ajax({
49 type: 'POST',
50 url: ajaxurl,
51 data: queryString,
52 cache: false,
53 dataType: "html",
54 success: function(data){
55
56 },
57 error: function(html){
58
59 }
60 });
61
62 }
63 });
64
65
66 });
1 msgid ""
2 msgstr ""
3 "Project-Id-Version: Post Types Order\n"
4 "POT-Creation-Date: 2017-07-17 16:03+0200\n"
5 "PO-Revision-Date: 2023-02-23 15:43+0200\n"
6 "Last-Translator: NspCode <contact@nsp-code.com>\n"
7 "Language-Team: \n"
8 "Language: en_US\n"
9 "MIME-Version: 1.0\n"
10 "Content-Type: text/plain; charset=UTF-8\n"
11 "Content-Transfer-Encoding: 8bit\n"
12 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
13 "X-Generator: Poedit 3.2\n"
14 "X-Poedit-KeywordsList: __;_e\n"
15 "X-Poedit-Basepath: ..\n"
16 "X-Poedit-SearchPath-0: .\n"
17
18 #: include/class.cpto.php:207
19 msgid "Post Types Order must be configured. Please go to"
20 msgstr ""
21
22 #: include/class.cpto.php:207
23 msgid "Settings Page"
24 msgstr ""
25
26 #: include/class.cpto.php:207
27 msgid "make the configuration and save"
28 msgstr ""
29
30 #: include/class.cpto.php:485 include/class.cpto.php:487
31 #: include/class.cpto.php:490 include/class.cpto.php:501
32 msgid "Re-Order"
33 msgstr ""
34
35 #: include/class.cpto.php:509
36 msgid ""
37 "This plugin can't work without javascript, because it's use drag and drop "
38 "and AJAX."
39 msgstr ""
40
41 #: include/class.cpto.php:522
42 msgid "Update"
43 msgstr ""
44
45 #: include/class.cpto.php:543
46 msgid "Items Order Updated"
47 msgstr ""
48
49 #: include/class.functions.php:104
50 msgid ""
51 "Did you find this plugin useful? Please support our work by purchasing the "
52 "advanced version or write an article about this plugin in your blog with a "
53 "link to our site"
54 msgstr ""
55
56 #: include/class.functions.php:105
57 msgid "Did you know there is available an Advanced version of this plug-in?"
58 msgstr ""
59
60 #: include/class.functions.php:105
61 msgid "Read more"
62 msgstr ""
63
64 #: include/class.functions.php:106
65 msgid "Check our"
66 msgstr ""
67
68 #: include/class.functions.php:106
69 msgid ""
70 "plugin which allow to custom sort categories and custom taxonomies terms"
71 msgstr ""
72
73 #: include/class.functions.php:107
74 msgid "Check out"
75 msgstr ""
76
77 #: include/class.functions.php:107
78 msgid ""
79 "the easy way to completely hide your WordPress core files, theme and plugins"
80 msgstr ""
81
82 #: include/class.functions.php:142 include/class.functions.php:221
83 #, php-format
84 msgid "Use commas instead of %s to separate excluded terms."
85 msgstr ""
86
87 #: include/class.options.php:40
88 msgid "Settings Saved"
89 msgstr ""
90
91 #: include/class.options.php:57
92 msgid "General Settings"
93 msgstr ""
94
95 #: include/class.options.php:63
96 msgid "General"
97 msgstr ""
98
99 #: include/class.options.php:67
100 msgid "Show / Hide re-order interface"
101 msgstr ""
102
103 #: include/class.options.php:94
104 msgid "Show"
105 msgstr ""
106
107 #: include/class.options.php:95
108 msgid "Hide"
109 msgstr ""
110
111 #: include/class.options.php:102
112 msgid "Minimum Level to use this plugin"
113 msgstr ""
114
115 #: include/class.options.php:105
116 msgid "Subscriber"
117 msgstr ""
118
119 #: include/class.options.php:106
120 msgid "Contributor"
121 msgstr ""
122
123 #: include/class.options.php:107
124 msgid "Author"
125 msgstr ""
126
127 #: include/class.options.php:108
128 msgid "Editor"
129 msgstr ""
130
131 #: include/class.options.php:109
132 msgid "Administrator"
133 msgstr ""
134
135 #: include/class.options.php:116
136 msgid "Auto Sort"
137 msgstr ""
138
139 #: include/class.options.php:118
140 msgid ""
141 "If checked, the plug-in automatically update the WordPress queries to use "
142 "the new order (<b>No code update is necessarily</b>)"
143 msgstr ""
144
145 #: include/class.options.php:119
146 msgid ""
147 "If only certain queries need to use the custom sort, keep this unchecked and "
148 "include 'orderby' => 'menu_order' into query parameters"
149 msgstr ""
150
151 #: include/class.options.php:121
152 msgid "Additional Description and Examples"
153 msgstr ""
154
155 #: include/class.options.php:128
156 msgid "Admin Sort"
157 msgstr ""
158
159 #: include/class.options.php:132
160 msgid ""
161 "To affect the admin interface, to see the post types per your new sort, this "
162 "need to be checked"
163 msgstr ""
164
165 #: include/class.options.php:137
166 msgid "Use query ASC / DESC parameter "
167 msgstr ""
168
169 #: include/class.options.php:141
170 msgid ""
171 "If the query include an Ascending or Descending order paramether, use that. "
172 "If query order is set to DESC the order will be reversed."
173 msgstr ""
174
175 #: include/class.options.php:146
176 msgid "Archive Drag&Drop "
177 msgstr ""
178
179 #: include/class.options.php:150
180 msgid ""
181 "Allow sortable drag & drop functionality within default WordPress post type "
182 "archive. Admin Sort need to be active."
183 msgstr ""
184
185 #: include/class.options.php:155
186 msgid "Next / Previous Apply"
187 msgstr ""
188
189 #: include/class.options.php:159
190 msgid "Apply the sort on Next / Previous site-wide navigation."
191 msgstr ""
192
193 #: include/class.options.php:159
194 msgid "This can also be controlled through"
195 msgstr ""
196
197 #: include/class.options.php:159
198 msgid "code"
199 msgstr ""
200
201 #: include/class.options.php:167
202 msgid "Save Settings"
203 msgstr ""
1 <?php
2 /*
3 Plugin Name: Post Types Order
4 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: 2.1
9 Text Domain: post-types-order
10 Domain Path: /languages/
11 */
12
13 define('CPTPATH', plugin_dir_path(__FILE__));
14 define('CPTURL', plugins_url('', __FILE__));
15
16 include_once(CPTPATH . '/include/class.cpto.php');
17 include_once(CPTPATH . '/include/class.functions.php');
18
19
20 add_action( 'plugins_loaded', 'cpto_class_load');
21 function cpto_class_load()
22 {
23
24 global $CPTO;
25 $CPTO = new CPTO();
26 }
27
28
29 add_action( 'plugins_loaded', 'cpto_load_textdomain');
30 function cpto_load_textdomain()
31 {
32 load_plugin_textdomain('post-types-order', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages');
33 }
34
35
36 add_action('wp_loaded', 'initCPTO' );
37 function initCPTO()
38 {
39 global $CPTO;
40
41 $options = $CPTO->functions->get_options();
42
43 if (is_admin())
44 {
45 if(isset($options['capability']) && !empty($options['capability']))
46 {
47 if( current_user_can($options['capability']) )
48 $CPTO->init();
49 }
50 else if (is_numeric($options['level']))
51 {
52 if ( $CPTO->functions->userdata_get_user_level(true) >= $options['level'] )
53 $CPTO->init();
54 }
55 else
56 {
57 $CPTO->init();
58 }
59 }
60 }
61
62
63
64 ?>
...\ No newline at end of file ...\ No newline at end of file
1 === Post Types Order ===
2 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: 6.3
7 Stable tag: 2.1
8
9 Sort Posts and custom Post Type Objects (custom post types) using a Drag and Drop Sortable JavaScript AJAX interface or default WordPress dashboard.
10
11 == Description ==
12
13 <strong>Over 6.8 MILLIONS DOWNLOADS and near PERFECT rating out of 200 REVIEWS</strong>. <br />
14 A powerful plugin, Order Posts and Post Types Objects using a Drag and Drop Sortable JavaScript capability.
15
16 The order can be customized within **default WordPress post type archive list page** or **a separate Re-Order interface** which displays all objects.
17 It allows reordering the posts for any custom post types you defined, including the default Posts. Post Order has never been easier.
18
19 = Usage =
20 This plugin was developed considering everyone to be able to use the sorting feature, no matter the WordPress experience:
21
22 * Install the plugin through the Install Plugins interface or by uploading the `post-types-order` folder to your `/wp-content/plugins/` directory.
23 * Activate the Post Order plugin.
24 * A new setting page will be created within Settings > Post Types Order, you should check with that, and make a first options save.
25 * Using the <strong>AutoSort option as ON</strong> you don't need to worry about any code changes, the <strong>plugin will apply the customized post order</strong> on fly.
26 * Use the Re-Order interface which appears to every custom post type (non-hierarchical) to change the post order to a new one.
27 * If prefer sort apply through the code, include 'orderby' =>'menu_order' within custom query arguments, more details at http://www.nsp-code.com/sample-code-on-how-to-apply-the-sort-for-post-types-order-plugin/
28
29 = Example of Usage =
30 [youtube http://www.youtube.com/watch?v=VEbNKFSfhCc]
31
32 As you can see just a matter of drag and drop and post ordering will change on front side right away.
33 If for some reason the post order does not update on your front side, you either do something wrong or the theme code you are using does not use a standard query per WordPress Codex rules and regulations. But we can still help, use the forum to report your issue as there are many peoples who gladly help or get in touch with us.
34
35 <br />Something is wrong with this plugin on your site? Just use the forum or get in touch with us at <a target="_blank" href="http://www.nsp-code.com">Contact</a> and we'll check it out.
36
37 <br />Need More? Check out the advanced version of this plugin at <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/">Advanced Post Types Order</a> which include Hierarchically post types order, Manual / Automatic Sorting, Individual Categories Order, Conditionals to apply, Paginations for large list, Mobile ready, Enhanced Interface, Plugins compatibility (MultiSite Network Support, WPML, Polylang, WooCommerce, WP E-Commerce, Platform Pro, Genesis etc), font side re-order interface, ... and many more !!
38
39 <br />
40 <br />This plugin is developed by <a target="_blank" href="http://www.nsp-code.com">Nsp-Code</a>
41
42 == Installation ==
43
44 1. Upload `post-types-order` folder to your `/wp-content/plugins/` directory.
45 2. Activate the plugin from Admin > Plugins menu.
46 3. Once activated you should check with Settings > Post Types Order
47 4. Use Re-Order link which appear into each post type section or use default WordPress interface to make your sorting.
48
49
50 == Screenshots ==
51
52 1. The ReOrder interface through which the sort can be created.
53
54 2. Sort can be managed within default WordPress post type interface.
55
56
57 == Frequently Asked Questions ==
58
59 Feel free to contact us at electronice_delphi@yahoo.com
60
61 = Since I have no PHP knowledge at all, is this plugin for me? =
62
63 Absolutely, you can!
64 Unlike many other plugins, you don't have to do any code changes to make your post order to apply, accordingly to custom-defined order. There is an option to auto-update the WordPress queries so the posts will be returned in customised order. This can be turned off (Autosort) to allow customized code usage.
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 does this plugin allow me to sort? =
71
72 You can sort ALL post types that you have defined into your WordPress as long they are not <strong>hierarhically</strong> defined: Posts (default WordPress custom post type), Movies, Reviews, Data etc..
73
74 = Ok, i understand about the template post types order, how about the admin interface? =
75
76 There's an option you can trigger, to see the post types order as you defined in the sort list, right into the main admin post list interface.
77
78 = There is a feature that i want it implemented, can you do something about it? =
79
80 All ideas are welcome and i put them on my list to be implemented into the new versions. Anyway this may take time, but if you are in a rush, please consider a small donation and we can arrange something.
81
82 = Can i make certain queries to ignore the custom sort when Autosort is turned On? =
83
84 This can be done by including the ignore_custom_sort within custom query arguments. An example can be found at <a target="_blank" href="http://www.nsp-code.com/advanced-post-types-order-api/sample-usage/">http://www.nsp-code.com/advanced-post-types-order-api/sample-usage/</a>
85
86 = How can i force the sort to apply for certain queries when AutoSort is turned On? =
87
88 A filter can be used to achieve that pto/posts_orderby. An example can be found at <a target="_blank" href="http://www.nsp-code.com/ignore-sort-apply-for-certain-query-on-post-types-order/">http://www.nsp-code.com/ignore-sort-apply-for-certain-query-on-post-types-order/</a>
89
90 = I still need more features like front sorting interface, shortcodes, filters, conditionals, advanced queries, taxonomy/ category sorting etc =
91
92 Consider upgrading to our advanced version of this plugin at a very resonable price <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/">Advanced Post Types Order</a>
93
94
95 == Change Log ==
96
97 = 2.1 =
98 - Trigger wp_cache_flush when saving the order to clear the internal caches
99 - WordPress 6.3 compatibility check and tag
100 - Compatibility update for lite speed cache
101
102 = 2.0.9 =
103 - Fix: is_plugin_active
104
105 = 2.0.7 =
106 - Compatibility class re-build
107 - Fix: Enfold templates when using Admin Sort
108
109 = 2.0.5 =
110 - Merge the "default archive&drop" option and keep the individual menu Yes/No for the default WordPress interfaces, to avoid confusion.
111
112 = 2.0.2 =
113 - The Archive drag & drop is disabled by default
114 - Small layout changes
115 - WordPress 6.2 compatibility tag
116
117 = 2.0 =
118 - Update cmoposer.json to use the wpackagist.org
119 - New option to select the drag & drop available for post types.
120 - The drag & drop within the default WordPress interfaces can be done now through the new icon, under the checkbox, for each item.
121 - Check if ajax call to avoid applying the order when autosort is disabled.
122 - Update plugin header image
123
124 = 1.9.9.2 =
125 - WordPress 6.1.1 compatibility tag
126
127 = 1.9.9.1 =
128 - WordPress 6.0 compatibility tag
129
130 = 1.9.9 =
131 - Fix layout change when sorting by drag&drop within default WordPress interface.
132 - Add placeholder row size by setting a tr colspan of the dragable element.
133
134 = 1.9.8 =
135 - Readme file updates, typos fixes.
136 - WordPress 5.9 compatibility tag
137
138 = 1.9.7 =
139 - Remove Twitter button
140 - Remove unused gif image
141 - HTPML and CSS cleanup
142
143 = 1.9.5.7 =
144 - Code cleanup
145 - WordPress 5.8.1 compatibility tag
146
147 = 1.9.5.6 =
148 - Fix PHP implode() notice
149
150 = 1.9.5.5 =
151 - Fix PHP implode() notice
152
153 = 1.9.5.4 =
154 - Fix PHP implode() notice
155 - Ensure the drag & drop interface show for correct post types, non hierarchically to ensure correct functionality
156 - WordPress 5.6 compatibility tag
157
158 = 1.9.5.2 =
159 - Clean post cache on order update to allow menu_order to change on cached data
160 - WordPress 5.5 compatibility tag
161
162 = 1.9.5.1 =
163 - Fix: Outputs the admin save notice through admin_notices filter
164
165 = 1.9.5 =
166 - Fix: disable drag & drop within taxonomies interfaces; fix WooCommerce attributes sort issue
167 - Reorder interface slight styles improvements
168 - Compatibility tag update for WordPress 5.4.2
169
170 = 1.9.4.3 =
171 - Option text translation update
172 - Changed the posts class to to wp-list-table when applying sortable for better compatibility
173 - Compatibility tag update for WordPress 5.4
174
175 = 1.9.4.2 =
176 - Compatibility tag update for WordPress 5.3
177
178 = 1.9.4.1 =
179 - Ignore the Events Calendar posts
180 - Filter typo fix
181
182 = 1.9.3.9 =
183 - Ignore sorting when doing Search and there's a search key-phrase specified.
184 - Ignore sorting when doing Search within admin dashboard
185 - Removed Google Social as it produced some JavaScript errors
186 - WordPress 4.9.7 tag update
187
188 = 1.9.3.6 =
189 - Clear LiteSpeed Cache on order update to reflect on front side
190 - WordPress 4.9.1 tag update
191
192 = 1.9.3.5 =
193 - Fix: updated capability from switch_theme to manage_options within 'Minimum Level to use this plugin' option
194 - Default admin capability changed from install_plugins to manage_options to prevent DISALLOW_FILE_MODS issue. https://wordpress.org/support/topic/plugin-breaks-when-disallow_file_mods-is-set-to-true/
195 - Prepare plugin for Composer package
196
197 = 1.9.3.3 =
198 - Plugin option to include query argument ASC / DESC
199
200 = 1.9.3.2 =
201 - Include ASC / DESC if there is a query order argument
202 - Avada fix 'product_orderby' ignore
203
204 = 1.9.3.1 =
205 - WordPress 4.8 compatibility notice
206 - Slight code changes, remove unused activate / deactivate hooks
207 - Updated po translation file
208 - Updated assets
209
210 = 1.9.3 =
211 - Fix for custom post type objects per page when using default archive interface drag & drop sort
212 - Plugin code redo and re-structure
213 - Improved compatibility with other plugins
214 - Security improvements for AJAX order updates
215
216 = 1.9 =
217 - Remove translations from the package
218 - Remove link for donate
219 - Wp Hide plugin availability notification
220 - New Filter pto/get_options to allow to change default options; Custom capability can be set for 'capability'
221 - New Filter pto/admin/plugin_options/capability to allow custom capability option to be inserted within html
222
223 = 1.8.9.2 =
224 - WPDB Prepare argument fix
225 - User preferance objects per page set to default if empty
226
227 = 1.8.9 =
228 - Add Nonce for admin settings
229 - Update queries to use prepare
230 - Drag & Drop Sortable within Post Type archive interface
231 - Code cleanup
232 - Set time limit for ajax calls to attempt a code execution extend
233
234 = 1.8.7 =
235 - Admin Post / Page Gallery items order fix
236 - New filter pto/posts_orderby to ignore sort apply
237
238 = 1.8.6 =
239 - PHP 7 deprecated nottice fix Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP;
240 - Fix: $_REQUEST['action'] comparison evaluate as Identical instead equal
241 - New filter cpto/interface_itme_data to append additional data for items within sortable interface
242 - Slight style updates
243 - Replaced Socialize FB like page
244
245 = 1.8.5 =
246 - Text domain change to post-types-order to allow translations at https://translate.wordpress.org/projects/wp-plugins/post-types-order
247 - New query argument ignore_custom_sort , to be used with Autosort. Ignore any customised sort and return posts in default order.
248
249 = 1.8.4.1 =
250 - Sortable interface styling improvements
251 - Portuguese translation update - Pedro Mendonca - http://www.pedromendonca.pt
252 - Text doamin fix for few texts
253
254 = 1.8.3.1 =
255 - Advanced Custom Fields Page Rule fix
256 - Show / Hide Re_order inderface for certain menus. Option available within Settings area.
257 - Media Sort interface objects order fix, when query-attachments REQUEST
258 - Bug - Thumbnails test code remove
259
260 = 1.8.2 =
261 - Media Uploaded To after sort fix
262
263 = 1.8.1 =
264 - Next / Previous sorting apply bug fix for custom taxonomies
265 - Portuguese translation update - Pedro Mendonca - http://www.pedromendonca.pt
266 - Options - phrase translation fix
267
268 = 1.7.9 =
269 - Next / Previous sorting apply option
270 - Filter for Next / Previous sorting applpy
271 - Help updates
272 - Appearance /css updates
273 - Admin columns sort fix
274 - Media re-order
275
276 = 1.7.7 =
277 - Next / Previous post link functionality update
278 - Code improvements
279 - Norvegian translation update - Bjorn Johansen bjornjohansen.no
280 - Czech translation - dUDLAJ; Martin Kucera - http://jsemweb.cz/
281
282 = 1.7.4 =
283 - Japanese translation - Git6 Sosuke Watanabe - http://git6.com/
284 - Portuguese translation update - Pedro Mendon?a - http://www.pedromendonca.pt
285 - Chinese translation - Coolwp coolwp.com@gmail.com
286
287 = 1.7.0 =
288 - Swedish translation - Onlinebyran - http://onlinebyran.se
289 - Portuguese translation - Pedro Mendon?a - http://www.pedromendonca.pt
290 - AJAX save filter
291
292 = 1.6.8 =
293 - Edit Gallery - image order fix
294 - "re-order" menu item allow translation
295 - Hungarian translation - Adam Laki - http://codeguide.hu/
296 - Minor admin style improvements
297
298 = 1.6.5 =
299 - Updates/Fixes
300 - German translation
301 - Norwegian (norsk) translation
302
303 = 1.6.4 =
304 - DISALLOW_FILE_MODS fix, change the administrator capability to switch_themes
305
306 = 1.6.3 =
307 - Updates/Fixes
308 - Menu Walker nottices Fix
309
310 = 1.6.2 =
311 - Updates/Fixes
312 - Turkish - T?rk?e translation
313
314 = 1.6.1 =
315 - Updates/Fixes
316 - Menu Walker nottices Fix
317 - Hebrew translation - Lunasite Team http://www.lunasite.co.il
318 - Dutch translation - Denver Sessink
319
320 = 1.5.8 =
321 - Updates/Fixes
322 - Ignore Search queries when Autosort is ON
323 - Text Instances translatable fix
324 - Italian translation - Black Studio http://www.blackstudio.it
325 - Spanish translation - Marcelo Cannobbio
326
327 = 1.5.7 =
328 - Updates/Fixes
329 - Using Capabilities instead levels
330 - Updating certain code for WordPress 3.5 compatibility
331 - Set default order as seccondary query order param
332
333 = 1.5.4 =
334 - Updates/Fixes
335
336 = 1.5.1 =
337 - Updates/Fixes
338
339 = 1.4.6 =
340 - Get Previous / Next Posts Update
341
342 = 1.4.3 =
343 - Small improvements
344
345 = 1.4.1 =
346 - Re-Order Menu Item Appearance fix for update versions
347 - Improved post order code
348
349 = 1.3.9 =
350 - Re-Order Menu Item Appearance fix
351
352 = 1.3.8 =
353 - Another Plugin conflict fix (thanks Steve Reed)
354 - Multiple Improvments (thanks for support Video Geek - bestpocketvideocams.com)
355 - Localisation Update (thanks Gabriel Reguly - ppgr.com.br/wordpress/)
356
357 = 1.1.2 =
358 - Bug Fix
359
360 = 1.0.9 =
361 - Admin will set the roles which can use the plugins (thanks for support Nick - peerpressurecreative.com)
362
363 = 1.0.2 =
364 - Default order used if no sort occour
365
366 = 1.0.1 =
367 - Post order support implemented
368
369 = 1.0 =
370 - First stable version (thanks for support Andrew - PageLines.com)
371
372 = 0.9. =
373 - Initial Release
374
375
376 == Upgrade Notice ==
377
378 Make sure you get the latest version.
379
380
381 == Localization ==
382
383 Want to contribute with a translation to your language? Please check at https://translate.wordpress.org/projects/wp-plugins/post-types-order
384 http://www.nsp-code.com