Category Order and Taxonomy Terms Order - Version 1.7

Version Description

  • Create the required columns for all sites, when running under MultiSite environment.
    • Compatibility tag update for WordPress 6.0.1
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 Category Order and Taxonomy Terms Order
Version 1.7
Comparing to
See all releases

Code changes from version 1.6.1 to 1.7

include/functions.php CHANGED
@@ -45,7 +45,25 @@
45
  }
46
  }
47
  return ($user_level);
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  function tto_info_box()
51
  {
45
  }
46
  }
47
  return ($user_level);
48
+ }
49
+
50
+
51
+ function tto_activate()
52
+ {
53
+ global $wpdb;
54
+
55
+ //check if the menu_order column exists;
56
+ $query = "SHOW COLUMNS FROM $wpdb->terms
57
+ LIKE 'term_order'";
58
+ $result = $wpdb->query($query);
59
+
60
+ if ($result == 0)
61
+ {
62
+ $query = "ALTER TABLE $wpdb->terms ADD `term_order` INT( 4 ) NULL DEFAULT '0'";
63
+ $result = $wpdb->query($query);
64
+ }
65
+ }
66
+
67
 
68
  function tto_info_box()
69
  {
include/interface.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
- function TOPluginInterface()
6
  {
7
  global $wpdb, $wp_locale;
8
 
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
+ function TO_PluginInterface()
6
  {
7
  global $wpdb, $wp_locale;
8
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nsp-code
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: category order,terms order, taxonomy order, admin order, categories sort, order category
5
  Requires at least: 2.8
6
- Tested up to: 6.0
7
- Stable tag: 1.6.1
8
 
9
  Order Categories and all custom taxonomies terms (hierarchically) using a Drag and Drop Sortable JavaScript capability.
10
 
@@ -60,6 +60,10 @@ Consider upgrading to our advanced version of this plugin at a very resonable pr
60
 
61
  == Change Log ==
62
 
 
 
 
 
63
  = 1.6.1 =
64
  - Compatibility tag update for WordPress 6.0
65
 
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: category order,terms order, taxonomy order, admin order, categories sort, order category
5
  Requires at least: 2.8
6
+ Tested up to: 6.0.1
7
+ Stable tag: 1.7
8
 
9
  Order Categories and all custom taxonomies terms (hierarchically) using a Drag and Drop Sortable JavaScript capability.
10
 
60
 
61
  == Change Log ==
62
 
63
+ = 1.7 =
64
+ - Create the required columns for all sites, when running under MultiSite environment.
65
+ - Compatibility tag update for WordPress 6.0.1
66
+
67
  = 1.6.1 =
68
  - Compatibility tag update for WordPress 6.0
69
 
taxonomy-terms-order.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Category Order and Taxonomy Terms Order
4
  Plugin URI: http://www.nsp-code.com
5
  Description: Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability.
6
- Version: 1.6.1
7
  Author: Nsp-Code
8
  Author URI: https://www.nsp-code.com
9
  Author Email: electronice_delphi@yahoo.com
@@ -18,21 +18,26 @@ Domain Path: /languages/
18
  register_deactivation_hook(__FILE__, 'TO_deactivated');
19
  register_activation_hook(__FILE__, 'TO_activated');
20
 
21
- function TO_activated()
22
  {
23
  global $wpdb;
24
-
25
- //check if the menu_order column exists;
26
- $query = "SHOW COLUMNS FROM $wpdb->terms
27
- LIKE 'term_order'";
28
- $result = $wpdb->query($query);
29
-
30
- if ($result == 0)
31
- {
32
- $query = "ALTER TABLE $wpdb->terms ADD `term_order` INT( 4 ) NULL DEFAULT '0'";
33
- $result = $wpdb->query($query);
 
 
 
 
34
  }
35
-
 
36
  }
37
 
38
  function TO_deactivated()
@@ -70,9 +75,8 @@ Domain Path: /languages/
70
  wp_enqueue_style( 'to.css');
71
  }
72
 
73
- add_action('admin_menu', 'TOPluginMenu', 99);
74
-
75
- function TOPluginMenu()
76
  {
77
  include (TOPATH . '/include/interface.php');
78
  include (TOPATH . '/include/terms_walker.php');
@@ -113,11 +117,11 @@ Domain Path: /languages/
113
  continue;
114
 
115
  if ($post_type == 'post')
116
- add_submenu_page('edit.php', __('Taxonomy Order', 'taxonomy-terms-order'), __('Taxonomy Order', 'taxonomy-terms-order'), $capability, 'to-interface-'.$post_type, 'TOPluginInterface' );
117
  elseif ($post_type == 'attachment')
118
- add_submenu_page('upload.php', __('Taxonomy Order', 'taxonomy-terms-order'), __('Taxonomy Order', 'taxonomy-terms-order'), $capability, 'to-interface-'.$post_type, 'TOPluginInterface' );
119
  else
120
- add_submenu_page('edit.php?post_type='.$post_type, __('Taxonomy Order', 'taxonomy-terms-order'), __('Taxonomy Order', 'taxonomy-terms-order'), $capability, 'to-interface-'.$post_type, 'TOPluginInterface' );
121
  }
122
  }
123
 
@@ -166,8 +170,8 @@ Domain Path: /languages/
166
  return $orderby;
167
  }
168
 
169
- add_action( 'wp_ajax_update-taxonomy-order', 'TOsaveAjaxOrder' );
170
- function TOsaveAjaxOrder()
171
  {
172
  global $wpdb;
173
 
3
  Plugin Name: Category Order and Taxonomy Terms Order
4
  Plugin URI: http://www.nsp-code.com
5
  Description: Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability.
6
+ Version: 1.7
7
  Author: Nsp-Code
8
  Author URI: https://www.nsp-code.com
9
  Author Email: electronice_delphi@yahoo.com
18
  register_deactivation_hook(__FILE__, 'TO_deactivated');
19
  register_activation_hook(__FILE__, 'TO_activated');
20
 
21
+ function TO_activated( $network_wide )
22
  {
23
  global $wpdb;
24
+
25
+ // check if it is a network activation
26
+ if ( $network_wide )
27
+ {
28
+ // Get all blog ids
29
+ $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
30
+ foreach ( $blogids as $blog_id )
31
+ {
32
+ switch_to_blog( $blog_id );
33
+ tto_activate();
34
+ restore_current_blog();
35
+ }
36
+
37
+ return;
38
  }
39
+ else
40
+ tto_activate();
41
  }
42
 
43
  function TO_deactivated()
75
  wp_enqueue_style( 'to.css');
76
  }
77
 
78
+ add_action('admin_menu', 'TO_PluginMenu', 99);
79
+ function TO_PluginMenu()
 
80
  {
81
  include (TOPATH . '/include/interface.php');
82
  include (TOPATH . '/include/terms_walker.php');
117
  continue;
118
 
119
  if ($post_type == 'post')
120
+ add_submenu_page('edit.php', __('Taxonomy Order', 'taxonomy-terms-order'), __('Taxonomy Order', 'taxonomy-terms-order'), $capability, 'to-interface-'.$post_type, 'TO_PluginInterface' );
121
  elseif ($post_type == 'attachment')
122
+ add_submenu_page('upload.php', __('Taxonomy Order', 'taxonomy-terms-order'), __('Taxonomy Order', 'taxonomy-terms-order'), $capability, 'to-interface-'.$post_type, 'TO_PluginInterface' );
123
  else
124
+ add_submenu_page('edit.php?post_type='.$post_type, __('Taxonomy Order', 'taxonomy-terms-order'), __('Taxonomy Order', 'taxonomy-terms-order'), $capability, 'to-interface-'.$post_type, 'TO_PluginInterface' );
125
  }
126
  }
127
 
170
  return $orderby;
171
  }
172
 
173
+ add_action( 'wp_ajax_update-taxonomy-order', 'TO_saveAjaxOrder' );
174
+ function TO_saveAjaxOrder()
175
  {
176
  global $wpdb;
177