Intuitive Custom Post Order - Version 2.0.0

Version Description

  • Select Sortable Objects. (Posts, Pages, and Custom Post Types)
  • Support Pages and hierarchical Custom Post Types.
  • Sortable Item's status is not only 'publish' but also other all status('pending', 'draft', 'private', 'future').
  • In Paging, it's all activated normaly. So, 'screen-per-page' is User like.
  • In Lists which sorted any category(Category, Tag, Taxonomy), it's all activated normaly.
  • Support Child posts and Child pages. When you sort any item, Relation of parent item between it's child items is maintained.
  • Bug fixed
Download this release

Release Info

Developer hijiri
Plugin Icon 128x128 Intuitive Custom Post Order
Version 2.0.0
Comparing to
See all releases

Code changes from version 3.0.3 to 2.0.0

admin/settings.php CHANGED
@@ -1,8 +1,7 @@
1
  <?php
2
 
3
- $hicpo_options = get_option( 'hicpo_options' );
4
- $hicpo_objects = isset( $hicpo_options['objects'] ) ? $hicpo_options['objects'] : array();
5
- $hicpo_tags = isset( $hicpo_options['tags'] ) ? $hicpo_options['tags'] : array();
6
 
7
  ?>
8
 
@@ -10,12 +9,12 @@ $hicpo_tags = isset( $hicpo_options['tags'] ) ? $hicpo_options['tags'] : array()
10
 
11
  <?php screen_icon( 'plugins' ); ?>
12
 
13
- <h2><?php _e( 'Intuitive Custom Post Order Settings', 'hicpo' ); ?></h2>
14
 
15
  <?php if ( isset($_GET['msg'] )) : ?>
16
  <div id="message" class="updated below-h2">
17
- <?php if ( $_GET['msg'] == 'update' ) : ?>
18
- <p><?php _e( 'Settings saved.' ); ?></p>
19
  <?php endif; ?>
20
  </div>
21
  <?php endif; ?>
@@ -24,85 +23,33 @@ $hicpo_tags = isset( $hicpo_options['tags'] ) ? $hicpo_options['tags'] : array()
24
 
25
  <?php if ( function_exists( 'wp_nonce_field' ) ) wp_nonce_field( 'nonce_hicpo' ); ?>
26
 
27
- <div id="hicpo_select_objects">
28
-
29
- <table class="form-table">
30
- <tbody>
31
- <tr valign="top">
32
- <th scope="row"><?php _e( 'Sortable Post Types', 'hicpo' ) ?></th>
33
- <td>
34
- <?php
35
- $post_types = get_post_types( array (
36
- 'show_ui' => true,
37
- 'show_in_menu' => true,
38
- ), 'objects' );
39
-
40
- foreach ( $post_types as $post_type ) {
41
- if ( $post_type->name == 'attachment' ) continue;
42
- ?>
43
- <label><input type="checkbox" name="objects[]" value="<?php echo $post_type->name; ?>" <?php if ( isset( $hicpo_objects ) && is_array( $hicpo_objects ) ) { if ( in_array( $post_type->name, $hicpo_objects ) ) { echo 'checked="checked"'; } } ?>>&nbsp;<?php echo $post_type->label; ?></label><br>
44
- <?php
45
- }
46
- ?>
47
- </td>
48
- </tr>
49
- </tbody>
50
- </table>
51
-
52
- </div>
53
-
54
- <label><input type="checkbox" id="hicpo_allcheck_objects"> <?php _e( 'All Check', 'hicpo' ) ?></label>
55
-
56
- <div id="hicpo_select_tags">
57
-
58
  <table class="form-table">
59
- <tbody>
60
- <tr valign="top">
61
- <th scope="row"><?php _e( 'Sortable Taxonomies', 'hicpo' ) ?></th>
62
- <td>
63
- <?php
64
- $taxonomies = get_taxonomies( array(
65
- 'show_ui' => true,
66
- ), 'objects' );
67
-
68
- foreach( $taxonomies as $taxonomy ) {
69
- if ( $taxonomy->name == 'post_format' ) continue;
70
- ?>
71
- <label><input type="checkbox" name="tags[]" value="<?php echo $taxonomy->name; ?>" <?php if ( isset( $hicpo_tags ) && is_array( $hicpo_tags ) ) { if ( in_array( $taxonomy->name, $hicpo_tags ) ) { echo 'checked="checked"'; } } ?>>&nbsp;<?php echo $taxonomy->label ?></label><br>
72
- <?php
73
  }
74
- ?>
75
- </td>
76
- </tr>
77
- </tbody>
 
78
  </table>
79
 
80
- </div>
81
-
82
- <label><input type="checkbox" id="hicpo_allcheck_tags"> <?php _e( 'All Check', 'hicpo' ) ?></label>
83
-
84
  <p class="submit">
85
- <input type="submit" class="button-primary" name="hicpo_submit" value="<?php _e( 'Update', 'cptg' ); ?>">
86
  </p>
87
 
88
  </form>
89
 
90
- </div>
91
-
92
- <script>
93
- (function($){
94
-
95
- $("#hicpo_allcheck_objects").on('click', function(){
96
- var items = $("#hicpo_select_objects input");
97
- if ( $(this).is(':checked') ) $(items).prop('checked', true);
98
- else $(items).prop('checked', false);
99
- });
100
-
101
- $("#hicpo_allcheck_tags").on('click', function(){
102
- var items = $("#hicpo_select_tags input");
103
- if ( $(this).is(':checked') ) $(items).prop('checked', true);
104
- else $(items).prop('checked', false);
105
- });
106
-
107
- })(jQuery)
108
- </script>
1
  <?php
2
 
3
+ $hicpo_options = get_option('hicpo_options');
4
+ $objects = $hicpo_options['objects'];
 
5
 
6
  ?>
7
 
9
 
10
  <?php screen_icon( 'plugins' ); ?>
11
 
12
+ <h2><?php _e('Intuitive Custom Post Order Settings', 'hicpo'); ?></h2>
13
 
14
  <?php if ( isset($_GET['msg'] )) : ?>
15
  <div id="message" class="updated below-h2">
16
+ <?php if ( $_GET['msg'] == 'update') : ?>
17
+ <p><?php _e('Settings saved.', 'hicpo'); ?></p>
18
  <?php endif; ?>
19
  </div>
20
  <?php endif; ?>
23
 
24
  <?php if ( function_exists( 'wp_nonce_field' ) ) wp_nonce_field( 'nonce_hicpo' ); ?>
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  <table class="form-table">
27
+ <tbody>
28
+ <tr valign="top">
29
+ <th scope="row"><label for="blogname"><?php _e('Sortable Objects', 'hicpo') ?></label></th>
30
+ <td>
31
+ <?php
32
+ $post_types = get_post_types( array (
33
+ 'public' => true
34
+ ), 'objects' );
35
+
36
+ foreach ($post_types as $post_type ) {
37
+ if ( $post_type->name != 'attachment' ) {
38
+ ?>
39
+ <label><input type="checkbox" name="objects[]" value="<?php echo $post_type->name; ?>" <?php if ( isset($objects) && is_array($objects) ) { if ( in_array($post_type->name, $objects )) { echo 'checked="checked"'; } } ?> />&nbsp;<?php echo $post_type->label; ?></label><br />
40
+ <?php
41
  }
42
+ }
43
+ ?>
44
+ </td>
45
+ </tr>
46
+ </tbody>
47
  </table>
48
 
 
 
 
 
49
  <p class="submit">
50
+ <input type="submit" class="button-primary" name="hicpo_submit" value="<?php _e('Update', 'cptg'); ?>" />
51
  </p>
52
 
53
  </form>
54
 
55
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
intuitive-custom-post-order.php CHANGED
@@ -2,215 +2,150 @@
2
  /*
3
  Plugin Name: Intuitive Custom Post Order
4
  Plugin URI: http://hijiriworld.com/web/plugins/intuitive-custom-post-order/
5
- Description: Intuitively, Order Items (Posts, Pages, and Custom Post Types and Custom Taxonomies) using a Drag and Drop Sortable JavaScript.
6
- Version: 3.0.3
7
  Author: hijiri
8
  Author URI: http://hijiriworld.com/web/
9
- License: GPLv2 or later
10
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
12
 
13
- /**
14
- * Define
15
- */
 
 
16
 
17
- define( 'HICPO_URL', plugins_url( '', __FILE__ ) );
18
- define( 'HICPO_DIR', plugin_dir_path( __FILE__ ) );
19
- load_plugin_textdomain( 'hicpo', false, basename( dirname( __FILE__ ) ).'/lang' );
 
20
 
21
- /**
22
- * Uninstall hook
 
23
  */
24
 
25
- register_uninstall_hook( __FILE__, 'hicpo_uninstall' );
26
- function hicpo_uninstall()
27
- {
28
- global $wpdb;
29
- if ( function_exists( 'is_multisite' ) && is_multisite() ) {
30
- $curr_blog = $wpdb->blogid;
31
- $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
32
- foreach( $blogids as $blog_id ) {
33
- switch_to_blog( $blog_id );
34
- hicpo_uninstall_db();
35
- }
36
- switch_to_blog( $curr_blog );
37
- } else {
38
- hicpo_uninstall_db();
39
- }
40
- }
41
- function hicpo_uninstall_db()
42
- {
43
- global $wpdb;
44
- $result = $wpdb->query( "DESCRIBE $wpdb->terms `term_order`" );
45
- if ( $result ){
46
- $query = "ALTER TABLE $wpdb->terms DROP `term_order`";
47
- $result = $wpdb->query( $query );
48
- }
49
- delete_option( 'hicpo_activation' );
50
- }
51
 
52
- /**
53
- * Class & Method
54
- */
55
 
56
- $hicpo = new Hicpo();
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  class Hicpo
59
  {
60
  function __construct()
61
  {
62
- if ( !get_option( 'hicpo_activation' ) ) $this->hicpo_activation();
63
 
64
- add_action( 'admin_menu', array( $this, 'admin_menu') );
65
 
66
- add_action( 'admin_init', array( $this, 'refresh' ) );
 
 
67
 
68
- add_action( 'admin_init', array( $this, 'update_options') );
69
- add_action( 'admin_init', array( $this, 'load_script_css' ) );
70
-
71
- // sortable ajax action
72
- add_action( 'wp_ajax_update-menu-order', array( $this, 'update_menu_order' ) );
73
- add_action( 'wp_ajax_update-menu-order-tags', array( $this, 'update_menu_order_tags' ) );
74
-
75
- // reorder post types
76
- add_filter( 'pre_get_posts', array( $this, 'hicpo_filter_active' ) );
77
- add_filter( 'pre_get_posts', array( $this, 'hicpo_pre_get_posts' ) );
78
-
79
- add_filter( 'get_previous_post_where', array( $this, 'hicpo_previous_post_where' ) );
80
- add_filter( 'get_previous_post_sort', array( $this, 'hicpo_previous_post_sort' ) );
81
- add_filter( 'get_next_post_where', array( $this, 'hocpo_next_post_where' ) );
82
- add_filter( 'get_next_post_sort', array( $this, 'hicpo_next_post_sort' ) );
83
-
84
- // reorder taxonomies
85
- add_filter( 'get_terms_orderby', array( $this, 'hicpo_get_terms_orderby' ), 10, 3 );
86
- add_filter( 'wp_get_object_terms', array( $this, 'hicpo_get_object_terms' ), 10, 3 );
87
- add_filter( 'get_terms', array( $this, 'hicpo_get_object_terms' ), 10, 3 );
88
  }
89
 
90
- function hicpo_activation()
91
  {
92
- global $wpdb;
93
- $result = $wpdb->query( "DESCRIBE $wpdb->terms `term_order`" );
94
- if ( !$result ) {
95
- $query = "ALTER TABLE $wpdb->terms ADD `term_order` INT( 4 ) NULL DEFAULT '0'";
96
- $result = $wpdb->query( $query );
 
 
 
 
 
 
 
97
  }
98
- update_option( 'hicpo_activation', 1 );
99
  }
100
-
101
  function admin_menu()
102
  {
103
- add_options_page( __( 'Intuitive CPO', 'hicpo' ), __( 'Intuitive CPO', 'hicpo' ), 'manage_options', 'hicpo-settings', array( $this,'admin_page' ));
104
  }
105
 
106
  function admin_page()
107
  {
108
  require HICPO_DIR.'admin/settings.php';
109
  }
110
-
111
- function _check_load_script_css()
112
  {
113
- $active = false;
 
114
 
115
- $objects = $this->get_hicpo_options_objects();
116
- $tags = $this->get_hicpo_options_tags();
117
-
118
- if ( empty( $objects ) && empty( $tags ) ) return false;
119
-
120
- // exclude (sorting, addnew page, edit page)
121
- if ( isset( $_GET['orderby'] ) || strstr( $_SERVER["REQUEST_URI"], 'action=edit' ) || strstr( $_SERVER["REQUEST_URI"], 'wp-admin/post-new.php' ) ) return false;
122
 
123
- // check post_type
124
- if ( !empty( $objects ) ) {
125
- // if page or custom post types
126
- if ( isset( $_GET['post_type'] ) && in_array( $_GET['post_type'], $objects ) ) {
127
- $active = true;
128
- // if post
129
- } else if ( strstr( $_SERVER["REQUEST_URI"], 'wp-admin/edit.php' ) && in_array( 'post', $objects ) ) {
130
  $active = true;
131
  }
132
- }
133
-
134
- // check taxonomy
135
- if ( !empty( $tags ) ) {
136
- if ( isset( $_GET['taxonomy'] ) && in_array( $_GET['taxonomy'], $tags ) ) {
137
  $active = true;
138
  }
139
  }
140
 
141
- return $active;
142
- }
143
-
144
- function load_script_css()
145
- {
146
- if ( $this->_check_load_script_css() ) {
147
-
148
- // load JavaScript
149
- wp_enqueue_script( 'jquery' );
150
- wp_enqueue_script( 'jquery-ui-sortable' );
151
- wp_enqueue_script( 'hicpojs', HICPO_URL.'/js/hicpo.js', array( 'jquery' ), null, true );
152
-
153
- // load CSS
154
- wp_enqueue_style( 'hicpo', HICPO_URL.'/css/hicpo.css', array(), null );
155
  }
156
  }
157
 
 
 
 
 
 
 
 
 
 
158
  function refresh()
159
  {
 
160
  global $wpdb;
161
 
162
- $objects = $this->get_hicpo_options_objects();
163
- $tags = $this->get_hicpo_options_tags();
164
-
165
- if ( !empty( $objects ) ) {
166
- foreach( $objects as $object) {
167
- $result = $wpdb->get_results( "
168
- SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min
169
- FROM $wpdb->posts
170
- WHERE post_type = '".$object."' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
171
- " );
172
-
173
- /**
174
- * アイテム数が 0、もしくはアイテム数とmaxが同じでminが0以外の場合は、再構築処理をスキップ
175
- */
176
- if ( $result[0]->cnt == 0 ) continue;
177
- if ( count( $result ) > 0 && $result[0]->cnt == $result[0]->max && $result[0]->min != 0 ) continue;
178
-
179
- $results = $wpdb->get_results( "
180
- SELECT ID
181
- FROM $wpdb->posts
182
- WHERE post_type = '".$object."' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
183
- ORDER BY menu_order ASC
184
- " );
185
- // 新規追加した場合 menu_order=0 で登録されるため、常に1からはじまるように振っておく
186
- foreach( $results as $key => $result ) {
187
- $wpdb->update( $wpdb->posts, array( 'menu_order' => $key+1 ), array( 'ID' => $result->ID ) );
188
- }
189
- }
190
- }
191
 
192
- if ( !empty( $tags ) ) {
193
- foreach( $tags as $taxonomy ) {
194
- $result = $wpdb->get_results( "
195
- SELECT count(*) as cnt, max(term_order) as max, min(term_order) as min
196
- FROM $wpdb->terms AS terms
197
- INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id )
198
- WHERE term_taxonomy.taxonomy = '".$taxonomy."'
199
- " );
200
-
201
- if ( $result[0]->cnt == 0 ) continue;
202
- if ( count( $result ) > 0 && $result[0]->max == $result[0]->cnt && $result[0]->min != 0 ) continue;
203
-
204
- $results = $wpdb->get_results( "
205
- SELECT terms.term_id
206
- FROM $wpdb->terms AS terms
207
- INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id )
208
- WHERE term_taxonomy.taxonomy = '".$taxonomy."'
209
- ORDER BY name ASC
210
- " );
211
- foreach( $results as $key => $result ) {
212
- $wpdb->update( $wpdb->terms, array( 'term_order' => $key+1 ), array( 'term_id' => $result->term_id ) );
213
- }
214
  }
215
  }
216
  }
@@ -218,249 +153,115 @@ class Hicpo
218
  function update_menu_order()
219
  {
220
  global $wpdb;
221
-
222
- parse_str( $_POST['order'], $data );
223
 
224
- if ( !is_array( $data ) ) return false;
 
 
225
 
226
- // get objects per now page
227
- $id_arr = array();
228
- foreach( $data as $key => $values ) {
229
- foreach( $values as $position => $id ) {
230
- $id_arr[] = $id;
 
231
  }
232
- }
233
-
234
- // get menu_order of objects per now page
235
- $menu_order_arr = array();
236
- foreach( $id_arr as $key => $id ) {
237
- $results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = ".intval( $id ) );
238
- foreach( $results as $result ) {
239
- $menu_order_arr[] = $result->menu_order;
240
  }
241
- }
242
-
243
- // maintains key association = no
244
- sort( $menu_order_arr );
245
-
246
- foreach( $data as $key => $values ) {
247
- foreach( $values as $position => $id ) {
248
- $wpdb->update( $wpdb->posts, array( 'menu_order' => $menu_order_arr[$position] ), array( 'ID' => intval( $id ) ) );
249
  }
250
  }
251
  }
252
 
253
- function update_menu_order_tags()
254
- {
255
- global $wpdb;
256
-
257
- parse_str( $_POST['order'], $data );
258
-
259
- if ( !is_array( $data ) ) return false;
260
-
261
- $id_arr = array();
262
- foreach( $data as $key => $values ) {
263
- foreach( $values as $position => $id ) {
264
- $id_arr[] = $id;
265
- }
266
- }
267
-
268
- $menu_order_arr = array();
269
- foreach( $id_arr as $key => $id ) {
270
- $results = $wpdb->get_results( "SELECT term_order FROM $wpdb->terms WHERE term_id = ".intval( $id ) );
271
- foreach( $results as $result ) {
272
- $menu_order_arr[] = $result->term_order;
273
- }
274
- }
275
- sort( $menu_order_arr );
276
-
277
- foreach( $data as $key => $values ) {
278
- foreach( $values as $position => $id ) {
279
- $wpdb->update( $wpdb->terms, array( 'term_order' => $menu_order_arr[$position] ), array( 'term_id' => intval( $id ) ) );
280
- }
281
- }
282
- }
283
 
284
  function update_options()
285
  {
286
- global $wpdb;
287
-
288
  if ( isset( $_POST['hicpo_submit'] ) ) {
289
-
290
  check_admin_referer( 'nonce_hicpo' );
291
 
292
- $input_options = array();
293
- $input_options['objects'] = isset( $_POST['objects'] ) ? $_POST['objects'] : '';
294
- $input_options['tags'] = isset( $_POST['tags'] ) ? $_POST['tags'] : '';
295
 
296
  update_option( 'hicpo_options', $input_options );
297
-
298
- /**
299
- * はじめて有効化されたオブジェクトの場合、ディフォルトの order に従って order 値をセットしておく。
300
- *
301
- * post type: orderby=date, order=desc
302
- * taxonomy: orderby=name, order=asc
303
- */
304
-
305
- $objects = $this->get_hicpo_options_objects();
306
- $tags = $this->get_hicpo_options_tags();
307
-
308
- if ( !empty( $objects ) ) {
309
- foreach( $objects as $object ) {
310
- /**
311
- * アイテム数が 0 以上で order 値がセットされていないオブジェクトが対象
312
- */
313
- $result = $wpdb->get_results( "
314
- SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min
315
- FROM $wpdb->posts
316
- WHERE post_type = '".$object."' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
317
- " );
318
- if ( count( $result ) > 0 && $result[0]->max == 0 ) {
319
- $results = $wpdb->get_results( "
320
- SELECT ID
321
- FROM $wpdb->posts
322
- WHERE post_type = '".$object."' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
323
- ORDER BY post_date DESC
324
- " );
325
- foreach( $results as $key => $result ) {
326
- $wpdb->update( $wpdb->posts, array( 'menu_order' => $key+1 ), array( 'ID' => $result->ID ) );
327
- }
328
- }
329
- }
330
- }
331
-
332
- if ( !empty( $tags ) ) {
333
- foreach( $tags as $taxonomy ) {
334
- $result = $wpdb->get_results( "
335
- SELECT count(*) as cnt, max(term_order) as max, min(term_order) as min
336
- FROM $wpdb->terms AS terms
337
- INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id )
338
- WHERE term_taxonomy.taxonomy = '".$taxonomy."'
339
- " );
340
- if ( count( $result ) > 0 && $result[0]->max == 0 ) {
341
- $results = $wpdb->get_results( "
342
- SELECT terms.term_id
343
- FROM $wpdb->terms AS terms
344
- INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id )
345
- WHERE term_taxonomy.taxonomy = '".$taxonomy."'
346
- ORDER BY name ASC
347
- " );
348
- foreach( $results as $key => $result ) {
349
- $wpdb->update( $wpdb->terms, array( 'term_order' => $key+1 ), array( 'term_id' => $result->term_id ) );
350
- }
351
- }
352
- }
353
- }
354
-
355
  wp_redirect( 'admin.php?page=hicpo-settings&msg=update' );
356
  }
357
  }
358
-
359
- function hicpo_previous_post_where( $where )
360
- {
361
- global $post;
362
 
363
- $objects = $this->get_hicpo_options_objects();
364
- if ( empty( $objects ) ) return $where;
365
-
366
- if ( isset( $post->post_type ) && in_array( $post->post_type, $objects ) ) {
367
- $current_menu_order = $post->menu_order;
368
- $where = "WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish'";
369
- }
370
- return $where;
371
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
372
 
373
- function hicpo_previous_post_sort( $orderby )
374
- {
375
- global $post;
376
-
377
- $objects = $this->get_hicpo_options_objects();
378
- if ( empty( $objects ) ) return $orderby;
379
-
380
- if ( isset( $post->post_type ) && in_array( $post->post_type, $objects ) ) {
381
- $orderby = 'ORDER BY p.menu_order ASC LIMIT 1';
382
- }
383
- return $orderby;
384
- }
385
 
386
- function hocpo_next_post_where( $where )
387
- {
388
- global $post;
389
-
390
- $objects = $this->get_hicpo_options_objects();
391
- if ( empty( $objects ) ) return $where;
392
-
393
- if ( isset( $post->post_type ) && in_array( $post->post_type, $objects ) ) {
394
- $current_menu_order = $post->menu_order;
395
- $where = "WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish'";
396
- }
397
- return $where;
398
- }
399
 
400
- function hicpo_next_post_sort( $orderby )
401
- {
402
- global $post;
403
-
404
- $objects = $this->get_hicpo_options_objects();
405
- if ( empty( $objects ) ) return $orderby;
406
-
407
- if ( isset( $post->post_type ) && in_array( $post->post_type, $objects ) ) {
408
- $orderby = 'ORDER BY p.menu_order DESC LIMIT 1';
409
  }
410
- return $orderby;
411
- }
412
 
413
- function hicpo_filter_active( $wp_query )
414
- {
415
- // get_postsの場合 suppress_filters=true となる為、フィルタリングを有効にする
416
- if ( isset($wp_query->query['suppress_filters']) ) $wp_query->query['suppress_filters'] = false;
417
- if ( isset($wp_query->query_vars['suppress_filters']) ) $wp_query->query_vars['suppress_filters'] = false;
418
- return $wp_query;
419
- }
420
 
421
- function hicpo_pre_get_posts( $wp_query )
422
- {
423
- global $args;
424
 
425
- $objects = $this->get_hicpo_options_objects();
426
 
427
- if ( !is_array( $objects ) ) return false;
428
 
429
- /**
430
- * for Admin
431
- */
432
-
433
- if ( is_admin() && !defined( 'DOING_AJAX' ) ) {
434
-
435
- /**
436
- * adminの場合 post_type=post も渡される
437
- * ゆえに $_GET['post_type] での判定はダメ
438
- */
439
-
440
- if ( isset( $wp_query->query['post_type'] ) && !isset( $_GET['orderby'] ) ) {
441
- if ( in_array( $wp_query->query['post_type'], $objects ) ) {
442
- $wp_query->set( 'orderby', 'menu_order' );
443
- $wp_query->set( 'order', 'ASC' );
444
- }
445
  }
 
446
 
447
- /**
448
- * for Front
449
- */
450
 
451
- } else {
452
-
453
- /**
454
- * $wp_query->query['post_type'] でオブジェクト判別
455
- * ディフォルトのクエリの場合 $args が渡ってこないので可能
456
- */
457
-
458
- $active = false;
459
 
460
- // post_typeが指定されている場合
461
-
462
- if ( isset( $wp_query->query['post_type'] ) ) {
463
- // 複数指定の場合は、いずれかひとつでも該当すれば有効とする
464
  if ( is_array( $wp_query->query['post_type'] ) ) {
465
  $post_types = $wp_query->query['post_type'];
466
  foreach( $post_types as $post_type ) {
@@ -473,90 +274,39 @@ class Hicpo
473
  $active = true;
474
  }
475
  }
476
- // post_typeが指定されていなければ post_type=post
477
-
478
  } else {
479
- if ( in_array( 'post', $objects ) ) {
480
- $active = true;
481
- }
482
- }
483
-
484
- /**
485
- * $args が存在した場合はそちらを優先する
486
- */
487
-
488
- if ( !$active ) return false;
489
-
490
- if ( isset( $args ) ) {
491
- // args = Array
492
- if ( is_array( $args ) ) {
493
- if ( !isset( $args['orderby'] ) ) $wp_query->set( 'orderby', 'menu_order' );
494
- if ( !isset( $args['order'] ) ) $wp_query->set( 'order', 'ASC' );
495
- // args = String
 
496
  } else {
497
- if ( !strstr( $args, 'orderby=' ) ) $wp_query->set( 'orderby', 'menu_order' );
498
- if ( !strstr( $args, 'order=' ) ) $wp_query->set( 'order', 'ASC' );
 
499
  }
500
- } else {
501
- if ( !$wp_query->get( 'orderby' ) ) $wp_query->set( 'orderby', 'menu_order' );
502
- if ( !$wp_query->get( 'order' ) && $wp_query->get( 'orderby' ) == 'menu_order') $wp_query->set( 'order', 'ASC' );;
503
- }
504
- }
505
- }
506
-
507
- function hicpo_get_terms_orderby( $orderby, $args )
508
- {
509
- if ( is_admin() ) return $orderby;
510
-
511
- $tags = $this->get_hicpo_options_tags();
512
-
513
- if( !isset( $args['taxonomy'] ) ) return $orderby;
514
-
515
- $taxonomy = $args['taxonomy'];
516
- if ( !in_array( $taxonomy, $tags ) ) return $orderby;
517
-
518
- $orderby = 't.term_order';
519
- return $orderby;
520
- }
521
-
522
- function hicpo_get_object_terms( $terms )
523
- {
524
- $tags = $this->get_hicpo_options_tags();
525
-
526
- if ( is_admin() && isset( $_GET['orderby'] ) ) return $terms;
527
-
528
- foreach( $terms as $key => $term ) {
529
- if ( is_object( $term ) && isset( $term->taxonomy ) ) {
530
- $taxonomy = $term->taxonomy;
531
- if ( !in_array( $taxonomy, $tags ) ) return $terms;
532
- } else {
533
- return $terms;
534
- }
535
  }
536
 
537
- usort( $terms, array( $this, 'taxcmp' ) );
538
- return $terms;
539
- }
540
-
541
- function taxcmp( $a, $b )
542
- {
543
- if ( $a->term_order == $b->term_order ) return 0;
544
- return ( $a->term_order < $b->term_order ) ? -1 : 1;
545
- }
546
-
547
- function get_hicpo_options_objects()
548
- {
549
- $hicpo_options = get_option( 'hicpo_options' ) ? get_option( 'hicpo_options' ) : array();
550
- $objects = isset( $hicpo_options['objects'] ) && is_array( $hicpo_options['objects'] ) ? $hicpo_options['objects'] : array();
551
- return $objects;
552
- }
553
- function get_hicpo_options_tags()
554
- {
555
- $hicpo_options = get_option( 'hicpo_options' ) ? get_option( 'hicpo_options' ) : array();
556
- $tags = isset( $hicpo_options['tags'] ) && is_array( $hicpo_options['tags'] ) ? $hicpo_options['tags'] : array();
557
- return $tags;
558
- }
559
-
560
  }
561
-
562
  ?>
2
  /*
3
  Plugin Name: Intuitive Custom Post Order
4
  Plugin URI: http://hijiriworld.com/web/plugins/intuitive-custom-post-order/
5
+ Description: Intuitively, Order Posts (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
6
+ Version: 2.0.0
7
  Author: hijiri
8
  Author URI: http://hijiriworld.com/web/
 
 
9
  */
10
 
11
+ /* Copyright 2013 hijiri
12
+
13
+ This program is free software; you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License, version 2, as
15
+ published by the Free Software Foundation.
16
 
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
 
22
+ You should have received a copy of the GNU General Public License
23
+ along with this program; if not, write to the Free Software
24
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
+ /***************************************************************
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
+ Define
30
+
31
+ ***************************************************************/
32
 
33
+ define( 'HICPO_URL', plugins_url('', __FILE__) );
34
+
35
+ define( 'HICPO_DIR', plugin_dir_path(__FILE__) );
36
+
37
+ load_plugin_textdomain( 'hicpo', false, basename(dirname(__FILE__)).'/lang' );
38
+
39
+ /***************************************************************
40
+
41
+ Class & Method
42
+
43
+ ***************************************************************/
44
+
45
+ $hicpo = new Hicpo();
46
 
47
  class Hicpo
48
  {
49
  function __construct()
50
  {
51
+ register_activation_hook( __FILE__, array( &$this, 'hicpo_install') );
52
 
53
+ add_action( 'admin_menu', array( &$this, 'admin_menu') );
54
 
55
+ add_action( 'admin_init', array( &$this, 'refresh' ) );
56
+ add_action( 'admin_init', array( &$this, 'update_options') );
57
+ add_action( 'init', array( &$this, 'enable_objects' ) );
58
 
59
+ add_action( 'wp_ajax_update-menu-order', array( &$this, 'update_menu_order' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
+ function hicpo_install()
63
  {
64
+ if ( !get_option('hicpo_options') ) {
65
+
66
+ $post_types = get_post_types( array (
67
+ 'public' => true
68
+ ), 'objects' );
69
+
70
+ foreach ($post_types as $post_type ) {
71
+ $init_objects[] = $post_type->name;
72
+ }
73
+ $input_options = array( 'objects' => $init_objects );
74
+
75
+ update_option( 'hicpo_options', $input_options );
76
  }
 
77
  }
78
+
79
  function admin_menu()
80
  {
81
+ add_utility_page( __('Intuitive CPO', 'hicpo'), __('Intuitive CPO', 'hicpo'), 'manage_options', 'hicpo-settings', array( &$this,'admin_page' ));
82
  }
83
 
84
  function admin_page()
85
  {
86
  require HICPO_DIR.'admin/settings.php';
87
  }
88
+
89
+ function enable_objects()
90
  {
91
+ $hicpo_options = get_option( 'hicpo_options' );
92
+ $objects = $hicpo_options['objects'];
93
 
94
+ $active = false;
 
 
 
 
 
 
95
 
96
+ // for Pages or Custom Post Types
97
+ if ( isset($_GET['post_type']) ) {
98
+ if ( in_array( $_GET['post_type'], $objects ) ) {
 
 
 
 
99
  $active = true;
100
  }
101
+ // for Posts
102
+ } else {
103
+ $post_list = strstr( $_SERVER["REQUEST_URI"], 'wp-admin/edit.php' );
104
+ if ( $post_list && in_array( 'post', $objects ) ) {
 
105
  $active = true;
106
  }
107
  }
108
 
109
+ if ( $active ) {
110
+ $this->load_script_css();
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
112
  }
113
 
114
+ function load_script_css() {
115
+ // load JavaScript
116
+ wp_enqueue_script( 'jQuery' );
117
+ wp_enqueue_script( 'jquery-ui-sortable' );
118
+ wp_enqueue_script( 'hicpojs', HICPO_URL.'/js/hicpo.js', array( 'jquery' ), null, true );
119
+ // load CSS
120
+ wp_enqueue_style( 'hicpo', HICPO_URL.'/css/hicpo.css', array(), null );
121
+ }
122
+
123
  function refresh()
124
  {
125
+ // menu_orderを再構築する
126
  global $wpdb;
127
 
128
+ $hicpo_options = get_option( 'hicpo_options' );
129
+ $objects = $hicpo_options['objects'];
130
+
131
+ foreach( $objects as $object) {
132
+ $sql = "SELECT
133
+ ID,
134
+ menu_order
135
+ FROM
136
+ $wpdb->posts
137
+ WHERE
138
+ post_type = '".$object."'
139
+ AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
140
+ ORDER BY
141
+ menu_order ASC
142
+ ";
143
+
144
+ $results = $wpdb->get_results($sql);
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
+ foreach( $results as $key => $result ) {
147
+ // 新規追加した場合「menu_order=0」で登録されるため、常に1からはじまるように振っておく
148
+ $wpdb->update( $wpdb->posts, array( 'menu_order' => $key+1 ), array( 'ID' => $result->ID ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
  }
151
  }
153
  function update_menu_order()
154
  {
155
  global $wpdb;
 
 
156
 
157
+ parse_str($_POST['order'], $data);
158
+
159
+ if ( is_array($data) ) {
160
 
161
+ // ページに含まれる記事のIDをすべて取得
162
+ $id_arr = array();
163
+ foreach( $data as $key => $values ) {
164
+ foreach( $values as $position => $id ) {
165
+ $id_arr[] = $id;
166
+ }
167
  }
168
+
169
+ // ページに含まれる記事のmenu_orderをすべて取得
170
+ $menu_order_arr = array();
171
+ foreach( $id_arr as $key => $id ) {
172
+ $results = $wpdb->get_results("SELECT menu_order FROM $wpdb->posts WHERE ID = ".$id);
173
+ foreach( $results as $result ) {
174
+ $menu_order_arr[] = $result->menu_order;
175
+ }
176
  }
177
+ // menu_order配列をソート(キーと値の相関関係は維持しない)
178
+ sort($menu_order_arr);
179
+
180
+ foreach( $data as $key => $values ) {
181
+ foreach( $values as $position => $id ) {
182
+ $wpdb->update( $wpdb->posts, array( 'menu_order' => $menu_order_arr[$position] ), array( 'ID' => $id ) );
183
+ }
 
184
  }
185
  }
186
  }
187
 
188
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
  function update_options()
191
  {
 
 
192
  if ( isset( $_POST['hicpo_submit'] ) ) {
193
+
194
  check_admin_referer( 'nonce_hicpo' );
195
 
196
+ $input_options = array( 'objects' => $_POST['objects'] );
 
 
197
 
198
  update_option( 'hicpo_options', $input_options );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  wp_redirect( 'admin.php?page=hicpo-settings&msg=update' );
200
  }
201
  }
202
+ }
 
 
 
203
 
204
+ /***************************************************************
205
+
206
+ output filter hook
207
+
208
+ ***************************************************************/
209
+
210
+ add_filter( 'pre_get_posts', 'hicpo_filter_active' );
211
+
212
+ function hicpo_filter_active( $wp_query )
213
+ {
214
+ // get_postsの場合 suppress_filters=true となる為、フィルタリングを有効にする
215
+ if ( isset($wp_query->query['suppress_filters']) ) $wp_query->query['suppress_filters'] = false;
216
+ if ( isset($wp_query->query_vars['suppress_filters']) ) $wp_query->query_vars['suppress_filters'] = false;
217
+ return $wp_query;
218
+ }
219
+
220
+ add_filter( 'pre_get_posts', 'hicpo_pre_get_posts' );
221
+
222
+ function hicpo_pre_get_posts( $wp_query )
223
+ {
224
+ $hicpo_options = get_option('hicpo_options');
225
+ $objects = $hicpo_options['objects'];
226
 
227
+ // for Admin ---------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
228
 
229
+ if ( is_admin() && !defined( 'DOING_AJAX' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
230
 
231
+ // post_type=post or page or custom post type
232
+ // adminの場合、post_tyope=postも渡される
233
+ if ( isset( $wp_query->query['post_type'] ) ) {
234
+ if ( in_array( $wp_query->query['post_type'], $objects ) ) {
235
+ $wp_query->set( 'orderby', 'menu_order' );
236
+ $wp_query->set( 'order', 'ASC' );
237
+ }
 
 
238
  }
 
 
239
 
240
+ // for Template ------------------------------------------------------------
 
 
 
 
 
 
241
 
242
+ } else {
 
 
243
 
244
+ $active = false;
245
 
246
+ // postsのWordpressループ ----------------
247
 
248
+ // $wp_query->queryが空配列の場合
249
+ // WordPressループでもposts以外はpost_typeが渡される
250
+
251
+ if ( empty( $wp_query->query ) ) {
252
+ if ( in_array( 'post', $objects ) ) {
253
+ $active = true;
 
 
 
 
 
 
 
 
 
 
254
  }
255
+ } else {
256
 
257
+ // get_posts() ----------------------
 
 
258
 
259
+ // 完全な判別ではないが、suppress_filtersパラメータの有無で判別
260
+ // get_posts()の場合、post_type, orderby, orderパラメータは必ず渡される
261
+
262
+ if ( isset($wp_query->query['suppress_filters']) ) {
 
 
 
 
263
 
264
+ // post_type判定
 
 
 
265
  if ( is_array( $wp_query->query['post_type'] ) ) {
266
  $post_types = $wp_query->query['post_type'];
267
  foreach( $post_types as $post_type ) {
274
  $active = true;
275
  }
276
  }
277
+
278
+ // query_posts() or WP_Query()
279
  } else {
280
+
281
+ // post_typeが指定されている場合
282
+ if ( isset( $wp_query->query['post_type'] ) ) {
283
+
284
+ // post_type判定
285
+ if ( is_array( $wp_query->query['post_type'] ) ) {
286
+ $post_types = $wp_query->query['post_type'];
287
+ foreach( $post_types as $post_type ) {
288
+ if ( in_array( $post_type, $objects ) ) {
289
+ $active = true;
290
+ }
291
+ }
292
+ } else {
293
+ if ( in_array( $wp_query->query['post_type'], $objects ) ) {
294
+ $active = true;
295
+ }
296
+ }
297
+ // post_typeが指定されてい場合はpost_type=post
298
  } else {
299
+ if ( in_array( 'post', $objects ) ) {
300
+ $active = true;
301
+ }
302
  }
303
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  }
305
 
306
+ if ( $active ) {
307
+ if ( !isset( $wp_query->query['orderby'] ) || $wp_query->query['orderby'] == 'post_date' ) $wp_query->set( 'orderby', 'menu_order' );
308
+ if ( !isset( $wp_query->query['order'] ) || $wp_query->query['order'] == 'DESC' ) $wp_query->set( 'order', 'ASC' );
309
+ }
310
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  }
 
312
  ?>
js/hicpo.js CHANGED
@@ -1,40 +1,21 @@
1
- (function($){
2
-
3
- // posts
4
-
5
- $('table.posts #the-list, table.pages #the-list').sortable({
6
  'items': 'tr',
7
  'axis': 'y',
8
  'helper': fixHelper,
9
  'update' : function(e, ui) {
10
- $.post( ajaxurl, {
11
  action: 'update-menu-order',
12
- order: $('#the-list').sortable('serialize'),
13
  });
14
  }
15
  });
16
- //$("#the-list").disableSelection();
17
-
18
- // tags
19
-
20
- $('table.tags #the-list').sortable({
21
- 'items': 'tr',
22
- 'axis': 'y',
23
- 'helper': fixHelper,
24
- 'update' : function(e, ui) {
25
- $.post( ajaxurl, {
26
- action: 'update-menu-order-tags',
27
- order: $('#the-list').sortable('serialize'),
28
- });
29
- }
30
  });
31
- //$("#the-list").disableSelection();
32
-
33
- var fixHelper = function(e, ui) {
34
- ui.children().children().each(function() {
35
- $(this).width($(this).width());
36
- });
37
- return ui;
38
- };
39
-
40
- })(jQuery)
1
+ jQuery(document).ready(function() {
2
+ jQuery("#the-list").sortable({
 
 
 
3
  'items': 'tr',
4
  'axis': 'y',
5
  'helper': fixHelper,
6
  'update' : function(e, ui) {
7
+ jQuery.post( ajaxurl, {
8
  action: 'update-menu-order',
9
+ order: jQuery("#the-list").sortable("serialize"),
10
  });
11
  }
12
  });
13
+ //jQuery("#the-list").disableSelection();
14
+ });
15
+
16
+ var fixHelper = function(e, ui) {
17
+ ui.children().children().each(function() {
18
+ jQuery(this).width(jQuery(this).width());
 
 
 
 
 
 
 
 
19
  });
20
+ return ui;
21
+ };
 
 
 
 
 
 
 
 
lang/default.pot CHANGED
@@ -1,44 +1,26 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: \n"
4
- "POT-Creation-Date: 2015-01-26 21:02+0900\n"
5
- "PO-Revision-Date: 2015-01-26 21:02+0900\n"
6
- "Last-Translator: hijiri <hijiriworld@gmail.com>\n"
7
- "Language-Team: \n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "X-Generator: Poedit 1.5.7\n"
12
- "X-Poedit-KeywordsList: __;_e\n"
13
 
14
- #: intuitive-custom-post-order/intuitive-custom-post-order.php:140
15
- msgid "Intuitive CPO"
16
- msgstr ""
17
-
18
- #: intuitive-custom-post-order/admin/settings.php:12
19
  msgid "Intuitive Custom Post Order Settings"
20
  msgstr ""
21
 
22
- #: intuitive-custom-post-order/admin/settings.php:17
23
  msgid "Settings saved."
24
  msgstr ""
25
 
26
- #: intuitive-custom-post-order/admin/settings.php:31
27
- msgid "Sortable Post Types"
28
- msgstr ""
29
-
30
- #: intuitive-custom-post-order/admin/settings.php:53
31
- msgid "All Check"
32
- msgstr ""
33
-
34
- #: intuitive-custom-post-order/admin/settings.php:60
35
- msgid "Sortable Taxonomies"
36
- msgstr ""
37
-
38
- #: intuitive-custom-post-order/admin/settings.php:62
39
- msgid "Custom Taxonomies Order becomes always effective."
40
  msgstr ""
41
 
42
- #: intuitive-custom-post-order/admin/settings.php:71
43
  msgid "Update"
44
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2013-02-28 17:44+0900\n"
5
+ "PO-Revision-Date: 2013-02-28 17:45+0900\n"
6
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
7
+ "Language-Team: LANGUAGE <LL@li.org>\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
 
 
11
 
12
+ #: admin/settings.php:12
 
 
 
 
13
  msgid "Intuitive Custom Post Order Settings"
14
  msgstr ""
15
 
16
+ #: admin/settings.php:17
17
  msgid "Settings saved."
18
  msgstr ""
19
 
20
+ #: admin/settings.php:29
21
+ msgid "Sortable Objects"
 
 
 
 
 
 
 
 
 
 
 
 
22
  msgstr ""
23
 
24
+ #: admin/settings.php:50
25
  msgid "Update"
26
  msgstr ""
lang/hicpo-ja.mo DELETED
Binary file
lang/hicpo-ja.po DELETED
@@ -1,44 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: \n"
4
- "POT-Creation-Date: 2015-01-26 21:02+0900\n"
5
- "PO-Revision-Date: 2015-01-26 21:05+0900\n"
6
- "Last-Translator: hijiri <hijiriworld@gmail.com>\n"
7
- "Language-Team: \n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Generator: Poedit 1.5.7\n"
12
- "X-Poedit-KeywordsList: __;_e\n"
13
-
14
- #: intuitive-custom-post-order/intuitive-custom-post-order.php:140
15
- msgid "Intuitive CPO"
16
- msgstr "並び替え設定"
17
-
18
- #: intuitive-custom-post-order/admin/settings.php:12
19
- msgid "Intuitive Custom Post Order Settings"
20
- msgstr "並び替え設定"
21
-
22
- #: intuitive-custom-post-order/admin/settings.php:17
23
- msgid "Settings saved."
24
- msgstr ""
25
-
26
- #: intuitive-custom-post-order/admin/settings.php:31
27
- msgid "Sortable Post Types"
28
- msgstr "並び替える投稿タイプ"
29
-
30
- #: intuitive-custom-post-order/admin/settings.php:53
31
- msgid "All Check"
32
- msgstr "すべて選択"
33
-
34
- #: intuitive-custom-post-order/admin/settings.php:60
35
- msgid "Sortable Taxonomies"
36
- msgstr "並び替えるカスタム分類"
37
-
38
- #: intuitive-custom-post-order/admin/settings.php:62
39
- msgid "Custom Taxonomies Order becomes always effective."
40
- msgstr "カスタム分類は常に並び替えが有効になります。"
41
-
42
- #: intuitive-custom-post-order/admin/settings.php:71
43
- msgid "Update"
44
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/hicpo-sv_SE.mo DELETED
Binary file
lang/hicpo-sv_SE.po DELETED
@@ -1,45 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Intuitive Custom Post Order v2.0.6\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2013-11-23 17:40+0100\n"
7
- "Last-Translator: Thomas Persson <info@ajfix.se>\n"
8
- "Language-Team: \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 1.5.7\n"
14
- "X-Poedit-SourceCharset: utf-8\n"
15
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
16
- "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
17
- "X-Poedit-Basepath: ../\n"
18
- "X-Textdomain-Support: yes\n"
19
- "Language: sv_SE\n"
20
- "X-Poedit-SearchPath-0: .\n"
21
-
22
- # @ hicpo
23
- #: admin/settings.php:12
24
- msgid "Intuitive Custom Post Order Settings"
25
- msgstr "Intuitive CPO Inst&auml;llningar"
26
-
27
- # @ hicpo
28
- #: admin/settings.php:17
29
- msgid "Settings saved."
30
- msgstr "Inst&auml;llningar sparade"
31
-
32
- # @ hicpo
33
- #: admin/settings.php:29
34
- msgid "Sortable Objects"
35
- msgstr "Sorteringsbara objekt"
36
-
37
- # @ cptg
38
- #: admin/settings.php:50
39
- msgid "Update"
40
- msgstr "Uppdatera"
41
-
42
- # @ hicpo
43
- #: intuitive-custom-post-order.php:117
44
- msgid "Intuitive CPO"
45
- msgstr "Intuitive CPO"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,103 +1,34 @@
1
  === Intuitive Custom Post Order ===
2
  Contributors: hijiri
3
- Tags: post order, posts order, order post, order posts, custom post type order, custom taxonomy order
4
- Requires at least: 3.5.0
5
- Tested up to: 4.1.0
6
- Stable tag: 3.0.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Intuitively, Order Items (Posts, Pages, and Custom Post Types, and Custom Taxonomies) using a Drag and Drop Sortable JavaScript.
11
 
12
  == Description ==
13
 
14
- Intuitively, Order Items (Posts, Pages, and Custom Post Types, and Custom Taxonomies) using a Drag and Drop Sortable JavaScript.
15
  Configuration is unnecessary.
16
  You can do directly on default WordPress administration.
17
 
18
- Your Query which uses 'order' or 'orderby' parameters is preferred. ( 'WP_Query()', 'get_posts()', 'query_posts()' )
19
 
20
  == Installation ==
21
 
22
- 1. Upload 'intuitive-custom-post-order' folder to the `/wp-content/plugins/` directory.
23
- 2. Activate the plugin through the 'Plugins' menu in WordPress.
24
- 3. Select Sortable Objects from Intuitive CPT Menu.
25
 
26
  == Screenshots ==
27
 
28
- 1. Reorder post
29
- 2. Reorder taxonomy
30
- 3. Settings
31
 
32
  == Changelog ==
33
 
34
- = 3.0.3 =
35
-
36
- * Performance improvement for Activation.
37
- * Add Initialize of Custom Taxonomy Order.
38
- * Fixed bug of refresh method.
39
- * Overwirting orderby, order improved.(Thanks @newash and @anriettec)
40
-
41
- = 3.0.1 & 3.0.2 =
42
-
43
- * Fixed bug
44
-
45
- = 3.0.0 =
46
-
47
- * Support the Custom Taxonomy Order!!
48
- ( wp_list_categories, get_categories, the_terms, the_tags, get_terms, get_the_terms, get_the_term_list, the_category, wp_dropdown_categories, the_taxonomies )
49
- * Suuport the sorting in admin UI.
50
- While having sorted, Drag and Drop Sortable Javascript don't run.
51
- * Support non public objects( show_ui=true, show_in_menu=true )
52
- * Add Japanese Translations.
53
-
54
- = 2.1.0 =
55
-
56
- * Fixed bug: Custom Query which uses 'order' or 'orderby' parameters is preferred.
57
- * It does not depend on the designation manner of arguments( Parameters ).
58
- ( $args = 'orderby=&order=' or $args = array( 'orderby' => '', 'order' => '' ) )
59
- * The trouble which exists in 2.0.7, 2.0.8, 2.0.9 was improved!
60
- * From 2.0.6 please update in 2.1.0.
61
-
62
- = 2.0.9 =
63
-
64
- * Performance improvement for Admin.
65
- Fatal performance problem was improved dramatically.
66
- * Fixed bug: Attachment objects are not broken.
67
- * Fixed bug: Alert warning on the multisite was solved.
68
- * Fixed bug: First when enabling items, 'menu order' of items are not broken.
69
- * Custom Query which uses 'order' or 'orderby' parameters is preferred.
70
-
71
- = 2.0.8 =
72
-
73
- * Performance improvement for Admin.
74
- Refresh method( re-constructing all menu order) run on only active object's List page.
75
-
76
- = 2.0.7 =
77
-
78
- * Fixed bug: for WordPress 3.8
79
- * Add Swedish Translations.(by Thomas)
80
-
81
- = 2.0.6 =
82
-
83
- * ver.2.0.5 fixed.
84
-
85
- = 2.0.5 =
86
-
87
- * Support 'next_post_link()' and 'previous_post_link()'(single to single).
88
-
89
- = 2.0.4 =
90
-
91
- * Fixed bug
92
-
93
- = 2.0.3 =
94
-
95
- * Intuitive CPO Settings Page was moved to Settings menu.
96
-
97
- = 2.0.2 =
98
-
99
- * Fixed bug
100
-
101
  = 2.0.0 =
102
 
103
  * Select Sortable Objects. (Posts, Pages, and Custom Post Types)
@@ -106,6 +37,7 @@ Your Query which uses 'order' or 'orderby' parameters is preferred. ( 'WP_Query(
106
  * In Paging, it's all activated normaly. So, 'screen-per-page' is User like.
107
  * In Lists which sorted any category(Category, Tag, Taxonomy), it's all activated normaly.
108
  * Support Child posts and Child pages. When you sort any item, Relation of parent item between it's child items is maintained.
 
109
 
110
  = 1.2.1 =
111
 
@@ -120,7 +52,7 @@ Your Query which uses 'order' or 'orderby' parameters is preferred. ( 'WP_Query(
120
 
121
  = 1.1.1 =
122
 
123
- * Fixed bug
124
 
125
  = 1.1.0 =
126
 
@@ -129,10 +61,4 @@ Your Query which uses 'order' or 'orderby' parameters is preferred. ( 'WP_Query(
129
 
130
  = 1.0.0 =
131
 
132
- Initial Release
133
-
134
- == Upgrade Notice ==
135
-
136
- = 3.0.3 =
137
-
138
- Expand Database Table: wp_terms.
1
  === Intuitive Custom Post Order ===
2
  Contributors: hijiri
3
+ Tags: post order, posts order, order post, order posts, custom post type order
4
+ Requires at least: 3.0.0
5
+ Tested up to: 3.5.1
6
+ Stable tag: 2.0.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Intuitively, Order posts(posts, any custom post types) using a Drag and Drop Sortable JavaScript.
11
 
12
  == Description ==
13
 
14
+ Intuitively, Order posts(posts, any custom post types) using a Drag and Drop Sortable JavaScript.
15
  Configuration is unnecessary.
16
  You can do directly on default WordPress administration.
17
 
18
+ Excluding custom query which uses 'order' or 'orderby' parameters, in 'get_posts' or 'query_posts' and so on.
19
 
20
  == Installation ==
21
 
22
+ 1. Upload 'intuitive-custom-post-order' folder to the `/wp-content/plugins/` directory
23
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
24
+ 3. (Optional) Navigate to the Intuitive CPT Menu
25
 
26
  == Screenshots ==
27
 
28
+ 1. Order items
 
 
29
 
30
  == Changelog ==
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  = 2.0.0 =
33
 
34
  * Select Sortable Objects. (Posts, Pages, and Custom Post Types)
37
  * In Paging, it's all activated normaly. So, 'screen-per-page' is User like.
38
  * In Lists which sorted any category(Category, Tag, Taxonomy), it's all activated normaly.
39
  * Support Child posts and Child pages. When you sort any item, Relation of parent item between it's child items is maintained.
40
+ * Bug fixed
41
 
42
  = 1.2.1 =
43
 
52
 
53
  = 1.1.1 =
54
 
55
+ * Bug fixed
56
 
57
  = 1.1.0 =
58
 
61
 
62
  = 1.0.0 =
63
 
64
+ Initial Release
 
 
 
 
 
 
screenshot-1.png ADDED
Binary file