Version Description
- 2022-04-27
- Do not use the previous change on admin dashboard, some WooCommerce pages are way too heavy with terms.
Download this release
Release Info
Developer | mpol |
Plugin | Custom Taxonomy Order NE |
Version | 3.4.2 |
Comparing to | |
See all releases |
Code changes from version 3.4.1 to 3.4.2
- customtaxorder.php +42 -36
- readme.txt +5 -1
customtaxorder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Custom Taxonomy Order
|
4 |
Plugin URI: https://wordpress.org/plugins/custom-taxonomy-order-ne/
|
5 |
Description: Allows for the ordering of categories and custom taxonomy terms through a simple drag-and-drop interface.
|
6 |
-
Version: 3.4.
|
7 |
Author: Marcel Pol
|
8 |
Author URI: https://timelord.nl/
|
9 |
License: GPLv2 or later
|
@@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
39 |
|
40 |
|
41 |
// Plugin Version
|
42 |
-
define('CUSTOMTAXORDER_VER', '3.4.
|
43 |
|
44 |
|
45 |
/*
|
@@ -235,23 +235,26 @@ function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
|
|
235 |
if ( is_object($ancestor_term) && isset($ancestor_term->term_order) ) {
|
236 |
|
237 |
// calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
$
|
247 |
-
if ( $
|
248 |
-
$
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
255 |
}
|
256 |
}
|
257 |
$rear_of_float .= (string) ($ancestor_term->term_order + $padding);
|
@@ -259,23 +262,26 @@ function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
|
|
259 |
}
|
260 |
|
261 |
// calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
$
|
271 |
-
if ( $
|
272 |
-
$
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
|
|
|
|
|
|
279 |
}
|
280 |
}
|
281 |
$rear_of_float .= (string) ($term->term_order + $padding);
|
3 |
Plugin Name: Custom Taxonomy Order
|
4 |
Plugin URI: https://wordpress.org/plugins/custom-taxonomy-order-ne/
|
5 |
Description: Allows for the ordering of categories and custom taxonomy terms through a simple drag-and-drop interface.
|
6 |
+
Version: 3.4.2
|
7 |
Author: Marcel Pol
|
8 |
Author URI: https://timelord.nl/
|
9 |
License: GPLv2 or later
|
39 |
|
40 |
|
41 |
// Plugin Version
|
42 |
+
define('CUSTOMTAXORDER_VER', '3.4.2');
|
43 |
|
44 |
|
45 |
/*
|
235 |
if ( is_object($ancestor_term) && isset($ancestor_term->term_order) ) {
|
236 |
|
237 |
// calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
|
238 |
+
// Do not do this on admin dashboard, some WooCommerce pages are way too heavy with terms.
|
239 |
+
if ( ! is_admin() ) {
|
240 |
+
$args = array(
|
241 |
+
'orderby' => 'term_order',
|
242 |
+
'order' => 'ASC',
|
243 |
+
'hide_empty' => false,
|
244 |
+
'parent' => $ancestor_id,
|
245 |
+
);
|
246 |
+
$sister_terms = get_term_children( $ancestor_id, $taxonomy );
|
247 |
+
if ( is_array( $sister_terms ) ) { // should always be an array, since this term does exist.
|
248 |
+
$count = count( $sister_terms );
|
249 |
+
if ( $count < 10 ) {
|
250 |
+
$padding = 0;
|
251 |
+
} else if ( $count < 100 ) {
|
252 |
+
$padding = 10;
|
253 |
+
} else if ( $count < 1000 ) {
|
254 |
+
$padding = 100;
|
255 |
+
} else if ( $count < 10000 ) {
|
256 |
+
$padding = 1000;
|
257 |
+
}
|
258 |
}
|
259 |
}
|
260 |
$rear_of_float .= (string) ($ancestor_term->term_order + $padding);
|
262 |
}
|
263 |
|
264 |
// calculate padding. Too much padding will have deep float calculations go wrong. See https://floating-point-gui.de/basic/
|
265 |
+
// Do not do this on admin dashboard, some WooCommerce pages are way too heavy with terms.
|
266 |
+
if ( ! is_admin() ) {
|
267 |
+
$args = array(
|
268 |
+
'orderby' => 'term_order',
|
269 |
+
'order' => 'ASC',
|
270 |
+
'hide_empty' => false,
|
271 |
+
'parent' => $term->parent,
|
272 |
+
);
|
273 |
+
$sister_terms = get_term_children( $term->parent, $taxonomy );
|
274 |
+
if ( is_array( $sister_terms ) ) { // should always be an array, since this term does exist.
|
275 |
+
$count = count( $sister_terms );
|
276 |
+
if ( $count < 10 ) {
|
277 |
+
$padding = 0;
|
278 |
+
} else if ( $count < 100 ) {
|
279 |
+
$padding = 10;
|
280 |
+
} else if ( $count < 1000 ) {
|
281 |
+
$padding = 100;
|
282 |
+
} else if ( $count < 10000 ) {
|
283 |
+
$padding = 1000;
|
284 |
+
}
|
285 |
}
|
286 |
}
|
287 |
$rear_of_float .= (string) ($term->term_order + $padding);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mpol
|
|
3 |
Tags: term order, category order, taxonomy order, order
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.9
|
6 |
-
Stable tag: 3.4.
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
|
@@ -213,6 +213,10 @@ The left metabox lists the toplevel terms. Right (or below) are the sub-terms.
|
|
213 |
|
214 |
== Changelog ==
|
215 |
|
|
|
|
|
|
|
|
|
216 |
= 3.4.1 =
|
217 |
* 2022-04-27
|
218 |
* Improve ordering nested sub-terms.
|
3 |
Tags: term order, category order, taxonomy order, order
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.9
|
6 |
+
Stable tag: 3.4.2
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
|
213 |
|
214 |
== Changelog ==
|
215 |
|
216 |
+
= 3.4.2 =
|
217 |
+
* 2022-04-27
|
218 |
+
* Do not use the previous change on admin dashboard, some WooCommerce pages are way too heavy with terms.
|
219 |
+
|
220 |
= 3.4.1 =
|
221 |
* 2022-04-27
|
222 |
* Improve ordering nested sub-terms.
|