Post Types Order - Version 1.0.2

Version Description

  • Default order used if no sort occour
Download this release

Release Info

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

Code changes from version 0.9 to 1.0.2

Files changed (3) hide show
  1. css/cpt.css +0 -5
  2. post-types-order.php +24 -7
  3. readme.txt +11 -2
css/cpt.css DELETED
@@ -1,5 +0,0 @@
1
- #sortable { list-style-type: none; margin: 10px 0 0; padding: 0; width: 100%; }
2
- #sortable ul { margin-left:20px; list-style: none; }
3
- #sortable li { margin: 4px 0; padding: 4px 0x; border: 1px solid #DDDDDD; -moz-border-radius:6px; cursor: move}
4
- #sortable li span { display: block; background: #f7f7f7; padding: 5px; color:#808080; font-size: font-size:14px; font-weight:bold;}
5
- #sortable li.placeholder{border: dashed 2px #ccc;background-color:#FFF;height:20px;}
 
 
 
 
 
post-types-order.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.nsp-code.com
5
  Description: Order Post Types Objects using a Drag and Drop Sortable javascript capability
6
  Author: NSP CODE
7
  Author URI: http://www.nsp-code.com
8
- Version: 0.9
9
  */
10
 
11
  define('CPTPATH', ABSPATH.'wp-content/plugins/post-types-order');
@@ -16,7 +16,7 @@ add_filter('posts_orderby', 'CPTOrderPosts');
16
  function CPTOrderPosts($orderBy)
17
  {
18
  global $wpdb;
19
- $orderBy = "{$wpdb->posts}.menu_order ASC";
20
  return($orderBy);
21
  }
22
 
@@ -180,7 +180,10 @@ class CPT
180
  $post_types = get_post_types();
181
  foreach( $post_types as $post_type_name )
182
  {
183
- add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order', 'manage_options', 'order-post-type-'.$post_type_name, array(&$this, 'pageManage') );
 
 
 
184
  }
185
  }
186
 
@@ -188,8 +191,9 @@ class CPT
188
  function pageManage() {
189
  ?>
190
  <div class="wrap">
191
- <h2><?php echo $this->current_post_type->labels->singular_name . ' - Re-order '?></h2>
192
-
 
193
  <div id="ajax-response"></div>
194
 
195
  <noscript>
@@ -230,6 +234,18 @@ class CPT
230
  });
231
  });
232
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
233
  </div>
234
  <?php
235
  }
@@ -242,7 +258,7 @@ class CPT
242
  'child_of' => 0, 'exclude' => '',
243
  'title_li' => __('Pages'), 'echo' => 1,
244
  'authors' => '', 'sort_column' => 'menu_order',
245
- 'link_before' => '', 'link_after' => '', 'walker' => '',
246
  );
247
 
248
  $r = wp_parse_args( $args, $defaults );
@@ -258,7 +274,8 @@ class CPT
258
  $r['hierarchical'] = 0;
259
  $args = array(
260
  'sort_column' => 'menu_order',
261
- 'post_type' => $post_type
 
262
  );
263
 
264
  $the_query = new WP_Query($args);
5
  Description: Order Post Types Objects using a Drag and Drop Sortable javascript capability
6
  Author: NSP CODE
7
  Author URI: http://www.nsp-code.com
8
+ Version: 1.0.2
9
  */
10
 
11
  define('CPTPATH', ABSPATH.'wp-content/plugins/post-types-order');
16
  function CPTOrderPosts($orderBy)
17
  {
18
  global $wpdb;
19
+ $orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
20
  return($orderBy);
21
  }
22
 
180
  $post_types = get_post_types();
181
  foreach( $post_types as $post_type_name )
182
  {
183
+ if ($post_type_name == 'post')
184
+ add_submenu_page('edit.php', 'Re-Order', 'Re-Order', 'manage_options', 'order-post-type-'.$post_type_name, array(&$this, 'pageManage') );
185
+ else
186
+ add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order', 'manage_options', 'order-post-type-'.$post_type_name, array(&$this, 'pageManage') );
187
  }
188
  }
189
 
191
  function pageManage() {
192
  ?>
193
  <div class="wrap">
194
+ <div class="icon32" id="icon-edit"><br></div>
195
+ <h2><?php echo $this->current_post_type->labels->singular_name . ' - Re-order '?></h2>
196
+
197
  <div id="ajax-response"></div>
198
 
199
  <noscript>
234
  });
235
  });
236
  </script>
237
+
238
+
239
+ <h3>Did you found this plug-in useful? Please support our work with a donation.</h3>
240
+ <div id="donate_form">
241
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
242
+ <input type="hidden" name="cmd" value="_s-xclick">
243
+ <input type="hidden" name="hosted_button_id" value="CU22TFDKJMLAE">
244
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
245
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
246
+ </form>
247
+ </div>
248
+ <br />
249
  </div>
250
  <?php
251
  }
258
  'child_of' => 0, 'exclude' => '',
259
  'title_li' => __('Pages'), 'echo' => 1,
260
  'authors' => '', 'sort_column' => 'menu_order',
261
+ 'link_before' => '', 'link_after' => '', 'walker' => ''
262
  );
263
 
264
  $r = wp_parse_args( $args, $defaults );
274
  $r['hierarchical'] = 0;
275
  $args = array(
276
  'sort_column' => 'menu_order',
277
+ 'post_type' => $post_type,
278
+ 'posts_per_page' => -1
279
  );
280
 
281
  $the_query = new WP_Query($args);
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Post Types Order ===
2
  Contributors: NSP CODE
3
  Donate link: http://www.nsp-code.com/donate.php
4
- Tags: post type order, custom post type order, post types order, page order, post order, custom order, ajax, re-order, drag-and-drop, admin, manage, custom, post, custom type, post type, order, ordering, sort
5
  Requires at least: 3.0
6
  Tested up to: 3.0.1
7
- Stable tag: 0.9
8
 
9
  Order Post Types Objects using a Drag and Drop Sortable javascript capability
10
 
@@ -30,6 +30,15 @@ Feel free to contact me at electronice_delphi@yahoo.com
30
 
31
  == Change Log ==
32
 
 
 
 
 
 
 
 
 
 
33
  = 0.9. =
34
  - Initial Release
35
 
1
  === Post Types Order ===
2
  Contributors: NSP CODE
3
  Donate link: http://www.nsp-code.com/donate.php
4
+ Tags: post type order, custom post type order, post types order, page order, post order, admin post order, admin custom post order, custom order, ajax, re-order, drag-and-drop, admin, manage, custom, post, custom type, post type, order, ordering, sort
5
  Requires at least: 3.0
6
  Tested up to: 3.0.1
7
+ Stable tag: 1.0.2
8
 
9
  Order Post Types Objects using a Drag and Drop Sortable javascript capability
10
 
30
 
31
  == Change Log ==
32
 
33
+ = 1.0.2 =
34
+ - Default order used if no sort occour
35
+
36
+ = 1.0.1 =
37
+ - Post order support implemented
38
+
39
+ = 1.0 =
40
+ - First stable version
41
+
42
  = 0.9. =
43
  - Initial Release
44