Post Types Order - Version 1.8.3

Version Description

  • Advanced Custom Fields Page Rule fix
    • Show / Hide Re_order inderface for certain menus. Option available within Settings area.
    • Media Sort interface objects order fix, when query-attachments REQUEST
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 Post Types Order
Version 1.8.3
Comparing to
See all releases

Code changes from version 1.8.2 to 1.8.3

include/cpto-class.php CHANGED
@@ -101,7 +101,17 @@
101
 
102
  //ignore bbpress
103
  if ($post_type_name == 'reply' || $post_type_name == 'topic')
104
- continue;
 
 
 
 
 
 
 
 
 
 
105
 
106
  if ($post_type_name == 'post')
107
  add_submenu_page('edit.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
@@ -109,8 +119,7 @@
109
  add_submenu_page('upload.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
110
  else
111
  {
112
- if (!is_post_type_hierarchical($post_type_name))
113
- add_submenu_page('edit.php?post_type='.$post_type_name, __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
114
  }
115
  }
116
  }
@@ -175,7 +184,7 @@
175
  function listPages($args = '')
176
  {
177
  $defaults = array(
178
- 'depth' => 0,
179
  'show_date' => '',
180
  'date_format' => get_option('date_format'),
181
  'child_of' => 0,
@@ -215,15 +224,10 @@
215
  $the_query = new WP_Query($args);
216
  $pages = $the_query->posts;
217
 
218
- if ( !empty($pages) ) {
219
- if ( $r['title_li'] )
220
- $output .= '<li class="pagenav intersect">' . $r['title_li'] . '<ul>';
221
-
222
- $output .= $this->walkTree($pages, $r['depth'], $r);
223
-
224
- if ( $r['title_li'] )
225
- $output .= '</ul></li>';
226
- }
227
 
228
  $output = apply_filters('wp_list_pages', $output, $r);
229
 
101
 
102
  //ignore bbpress
103
  if ($post_type_name == 'reply' || $post_type_name == 'topic')
104
+ continue;
105
+
106
+ if(is_post_type_hierarchical($post_type_name))
107
+ continue;
108
+
109
+ $post_type_data = get_post_type_object( $post_type_name );
110
+ if($post_type_data->show_ui === FALSE)
111
+ continue;
112
+
113
+ if(isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] != 'show')
114
+ continue;
115
 
116
  if ($post_type_name == 'post')
117
  add_submenu_page('edit.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
119
  add_submenu_page('upload.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
120
  else
121
  {
122
+ add_submenu_page('edit.php?post_type='.$post_type_name, __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
 
123
  }
124
  }
125
  }
184
  function listPages($args = '')
185
  {
186
  $defaults = array(
187
+ 'depth' => -1,
188
  'show_date' => '',
189
  'date_format' => get_option('date_format'),
190
  'child_of' => 0,
224
  $the_query = new WP_Query($args);
225
  $pages = $the_query->posts;
226
 
227
+ if ( !empty($pages) )
228
+ {
229
+ $output .= $this->walkTree($pages, $r['depth'], $r);
230
+ }
 
 
 
 
 
231
 
232
  $output = apply_filters('wp_list_pages', $output, $r);
233
 
include/functions.php CHANGED
@@ -33,6 +33,7 @@
33
  $options = get_option('cpto_options');
34
 
35
  $defaults = array (
 
36
  'autosort' => 1,
37
  'adminsort' => 1,
38
  'capability' => 'install_plugins',
33
  $options = get_option('cpto_options');
34
 
35
  $defaults = array (
36
+ 'show_reorder_interfaces' => array(),
37
  'autosort' => 1,
38
  'adminsort' => 1,
39
  'capability' => 'install_plugins',
include/options.php CHANGED
@@ -7,11 +7,12 @@ function cpt_plugin_options()
7
 
8
  if (isset($_POST['form_submit']))
9
  {
 
10
 
11
- $options['capability'] = $_POST['capability'];
12
 
13
- $options['autosort'] = isset($_POST['autosort']) ? $_POST['autosort'] : '';
14
- $options['adminsort'] = isset($_POST['adminsort']) ? $_POST['adminsort'] : '';
15
 
16
  $options['navigation_sort_apply'] = isset($_POST['navigation_sort_apply']) ? $_POST['navigation_sort_apply'] : '';
17
 
@@ -36,7 +37,41 @@ function cpt_plugin_options()
36
  <h2 class="subtitle"><?php _e('General', 'cpt') ?></h2>
37
  <table class="form-table">
38
  <tbody>
39
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <tr valign="top">
41
  <th scope="row" style="text-align: right;"><label><?php _e('Minimum Level to use this plugin', 'cpt') ?></label></th>
42
  <td>
7
 
8
  if (isset($_POST['form_submit']))
9
  {
10
+ $options['show_reorder_interfaces'] = $_POST['show_reorder_interfaces'];
11
 
12
+ $options['capability'] = $_POST['capability'];
13
 
14
+ $options['autosort'] = isset($_POST['autosort']) ? $_POST['autosort'] : '';
15
+ $options['adminsort'] = isset($_POST['adminsort']) ? $_POST['adminsort'] : '';
16
 
17
  $options['navigation_sort_apply'] = isset($_POST['navigation_sort_apply']) ? $_POST['navigation_sort_apply'] : '';
18
 
37
  <h2 class="subtitle"><?php _e('General', 'cpt') ?></h2>
38
  <table class="form-table">
39
  <tbody>
40
+ <tr valign="top">
41
+ <th scope="row" style="text-align: right;"><label><?php _e('Show / Hide re-order interface', 'cpt') ?></label></th>
42
+ <td>
43
+ <?php
44
+
45
+ $post_types = get_post_types();
46
+ foreach( $post_types as $post_type_name )
47
+ {
48
+ //ignore list
49
+ $ignore_post_types = array(
50
+ 'reply',
51
+ 'topic',
52
+ 'report',
53
+ 'status'
54
+ );
55
+
56
+ if(in_array($post_type_name, $ignore_post_types))
57
+ continue;
58
+
59
+ if(is_post_type_hierarchical($post_type_name))
60
+ continue;
61
+
62
+ $post_type_data = get_post_type_object( $post_type_name );
63
+ if($post_type_data->show_ui === FALSE)
64
+ continue;
65
+ ?>
66
+ <p><label>
67
+ <select name="show_reorder_interfaces[<?php echo $post_type_name ?>]">
68
+ <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 _e( "Show", 'apto' ) ?></option>
69
+ <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 _e( "Hide", 'apto' ) ?></option>
70
+ </select> &nbsp;&nbsp;<?php echo $post_type_data->labels->singular_name ?>
71
+ </label><br />&nbsp;</p>
72
+ <?php } ?>
73
+ </td>
74
+ </tr>
75
  <tr valign="top">
76
  <th scope="row" style="text-align: right;"><label><?php _e('Minimum Level to use this plugin', 'cpt') ?></label></th>
77
  <td>
include/walkers.php CHANGED
@@ -26,7 +26,27 @@
26
 
27
  extract($args, EXTR_SKIP);
28
 
29
- $output .= $indent . '<li id="item_'.$page->ID.'"><span>'.apply_filters( 'the_title', $page->post_title, $page->ID ).'</span>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
 
26
 
27
  extract($args, EXTR_SKIP);
28
 
29
+ //----
30
+ if($page->post_type == 'attachment')
31
+ $image_id = $page->ID;
32
+ else
33
+ $image_id = get_post_thumbnail_id( $page->ID , 'post-thumbnail' );
34
+ if ($image_id > 0)
35
+ {
36
+ $image = wp_get_attachment_image_src( $image_id , array(195,195));
37
+ if($image !== FALSE)
38
+ $image_html = '<img style="width:50px" src="'. $image[0] .'" alt="" />';
39
+ else
40
+ $image_html = '<img src="'. CPTURL .'/images/nt.png" alt="" />';
41
+ }
42
+ else
43
+ {
44
+ $image_html = '<img src="'. CPTURL .'/images/nt.png" alt="" />';
45
+ }
46
+ $output .= $indent . '<li id="item_'.$page->ID.'"><span>'. $page->ID . ' ' .apply_filters( 'the_title', $page->post_title, $page->ID ).'</span> ' . $image_html;
47
+
48
+
49
+ //$output .= $indent . '<li id="item_'.$page->ID.'"><span>'.apply_filters( 'the_title', $page->post_title, $page->ID ).'</span>';
50
  }
51
 
52
 
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.8.2
9
  */
10
 
11
  define('CPTPATH', plugin_dir_path(__FILE__));
@@ -87,6 +87,14 @@ Version: 1.8.2
87
  (defined('DOING_AJAX') && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments')
88
  )
89
  {
 
 
 
 
 
 
 
 
90
  $orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
91
  }
92
  }
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.8.3
9
  */
10
 
11
  define('CPTPATH', plugin_dir_path(__FILE__));
87
  (defined('DOING_AJAX') && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments')
88
  )
89
  {
90
+
91
+ global $post;
92
+
93
+ //temporary ignore ACF group and admin ajax calls, should be fixed within ACF plugin sometime later
94
+ if (is_object($post) && $post->post_type == "acf-field-group"
95
+ || (defined('DOING_AJAX') && isset($_REQUEST['action']) && strpos($_REQUEST['action'], 'acf/') < 1))
96
+ return $orderBy;
97
+
98
  $orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
99
  }
100
  }
readme.txt CHANGED
@@ -3,13 +3,13 @@ Contributors: Nsp Code
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post order, post type order, custom order, admin posts order
5
  Requires at least: 2.8
6
- Tested up to: 4.2.2
7
 
8
  Post Order and custom Post Type Objects (posts, any custom post types) using a Drag and Drop Sortable JavaScript AJAX interface.
9
 
10
  == Description ==
11
 
12
- <strong>Over 1.000.000 DOWNLOADS and near PERFECT ratting out of 150 REVIEWS</strong>. <br />
13
  A powerful plugin, Order Posts and Post Types Objects using a Drag and Drop Sortable JavaScript capability.
14
  It allow to reorder the posts for any custom post types you defined, including the default Posts. Also you can have the admin posts interface sorted per your new sort. Post Order has never been easier.
15
 
@@ -28,6 +28,8 @@ This was built considering for everyone to be able to use no matter the WordPres
28
  As you can see just a matter of drag and drop and post ordering will change on front side right away.
29
  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.
30
 
 
 
31
  <br />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>
32
 
33
  <br />
@@ -67,6 +69,11 @@ All ideas are welcome and i put them on my list to be implemented into the new v
67
 
68
  == Change Log ==
69
 
 
 
 
 
 
70
  = 1.8.2 =
71
  - Media Uploaded To after sort fix
72
 
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post order, post type order, custom order, admin posts order
5
  Requires at least: 2.8
6
+ Tested up to: 4.2.4
7
 
8
  Post Order and custom Post Type Objects (posts, any custom post types) using a Drag and Drop Sortable JavaScript AJAX interface.
9
 
10
  == Description ==
11
 
12
+ <strong>Over 1.200.000 DOWNLOADS and near PERFECT ratting out of 150 REVIEWS</strong>. <br />
13
  A powerful plugin, Order Posts and Post Types Objects using a Drag and Drop Sortable JavaScript capability.
14
  It allow to reorder the posts for any custom post types you defined, including the default Posts. Also you can have the admin posts interface sorted per your new sort. Post Order has never been easier.
15
 
28
  As you can see just a matter of drag and drop and post ordering will change on front side right away.
29
  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.
30
 
31
+ <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.
32
+
33
  <br />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>
34
 
35
  <br />
69
 
70
  == Change Log ==
71
 
72
+ = 1.8.3 =
73
+ - Advanced Custom Fields Page Rule fix
74
+ - Show / Hide Re_order inderface for certain menus. Option available within Settings area.
75
+ - Media Sort interface objects order fix, when query-attachments REQUEST
76
+
77
  = 1.8.2 =
78
  - Media Uploaded To after sort fix
79