Custom Taxonomy Order NE - Version 3.3.2

Version Description

  • 2021-12-24
  • Add function 'customtaxorder_is_get_orderby_set'.
  • Add filter 'customtaxorder_is_get_orderby_set' to optionally change the output of that function.
  • Fix warning on PHP 8.1.
  • Show taxonomy name as label on dashboard, if label is not set.
  • Remove old translation files from plugin, GlotPress should be used.
  • Do not show all submenu items on dashboard if they are over 100 (fix for Woo attributes).
Download this release

Release Info

Developer mpol
Plugin Icon 128x128 Custom Taxonomy Order NE
Version 3.3.2
Comparing to
See all releases

Code changes from version 3.3.1 to 3.3.2

admin-customtaxorder.php CHANGED
@@ -33,23 +33,44 @@ add_action('admin_init', 'customtaxorder_register_settings');
33
  */
34
  function customtaxorder_menu() {
35
 
36
- $taxonomies = customtaxorder_get_taxonomies() ;
37
-
38
- $taxonomies = customtaxorder_sort_taxonomies( $taxonomies );
39
  // Set your custom capability through this filter.
40
  $custom_cap = apply_filters( 'customtaxorder_custom_cap', 'manage_categories' );
41
 
42
  //add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '', int $position = null )
43
- add_menu_page(esc_html__('Term Order', 'custom-taxonomy-order-ne'), esc_html__('Term Order', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder', 'customtaxorder_subpage', 'dashicons-list-view', 122.35);
44
  //add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', int $position = null )
45
  add_submenu_page('customtaxorder', esc_html__('Order Taxonomies', 'custom-taxonomy-order-ne'), esc_html__('Order Taxonomies', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder-taxonomies', 'custom_taxonomy_order');
46
 
47
- foreach ($taxonomies as $taxonomy ) {
48
- // Set your finegrained capability for this taxonomy for this custom filter.
49
- $custom_cap_tax = apply_filters( 'customtaxorder_custom_cap_' . $taxonomy->name, $custom_cap );
50
- add_submenu_page('customtaxorder', esc_html__('Order ', 'custom-taxonomy-order-ne') . $taxonomy->label, esc_html__('Order ', 'custom-taxonomy-order-ne') . $taxonomy->label, $custom_cap_tax, 'customtaxorder-'.$taxonomy->name, 'customtaxorder_subpage');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
  add_submenu_page('customtaxorder', esc_html__('About', 'custom-taxonomy-order-ne'), esc_html__('About', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder-about', 'customtaxorder_about');
 
53
  }
54
  add_action('admin_menu', 'customtaxorder_menu');
55
 
33
  */
34
  function customtaxorder_menu() {
35
 
 
 
 
36
  // Set your custom capability through this filter.
37
  $custom_cap = apply_filters( 'customtaxorder_custom_cap', 'manage_categories' );
38
 
39
  //add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '', int $position = null )
40
+ add_menu_page(esc_html__('Term Order', 'custom-taxonomy-order-ne'), esc_html__('Term Order', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder', 'customtaxorder_subpage', 'dashicons-list-view', 122);
41
  //add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', int $position = null )
42
  add_submenu_page('customtaxorder', esc_html__('Order Taxonomies', 'custom-taxonomy-order-ne'), esc_html__('Order Taxonomies', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder-taxonomies', 'custom_taxonomy_order');
43
 
44
+ $taxonomies = customtaxorder_get_taxonomies() ;
45
+ $taxonomies = customtaxorder_sort_taxonomies( $taxonomies );
46
+ $tax_count = count( $taxonomies );
47
+
48
+ /* WooCommerce attributes cabn genarate lots of custom taxonomies. The submenu gets too large on non-taxorder pages. */
49
+ $page_customtaxorder = false;
50
+ if ( isset($_GET['page']) ) {
51
+ $pos_page = sanitize_text_field( $_GET['page'] );
52
+ $pos_args = 'customtaxorder';
53
+ $pos = strpos($pos_page, $pos_args);
54
+ if ( $pos !== false ) {
55
+ $page_customtaxorder = true;
56
+ }
57
+ }
58
+
59
+ if ( $tax_count < 100 || $page_customtaxorder === true ) {
60
+ foreach ($taxonomies as $taxonomy ) {
61
+ $tax_label = $taxonomy->label;
62
+ if ( ! isset( $tax_label ) || strlen( $tax_label ) === 0 ) {
63
+ $tax_label = $taxonomy->name;
64
+ }
65
+ $tax_name = $taxonomy->name;
66
+
67
+ // Set your finegrained capability for this taxonomy for this custom filter.
68
+ $custom_cap_tax = apply_filters( 'customtaxorder_custom_cap_' . $tax_name, $custom_cap );
69
+ add_submenu_page('customtaxorder', esc_html__('Order ', 'custom-taxonomy-order-ne') . $tax_label, esc_html__('Order ', 'custom-taxonomy-order-ne') . $tax_label, $custom_cap_tax, 'customtaxorder-'.$tax_name, 'customtaxorder_subpage');
70
+ }
71
  }
72
  add_submenu_page('customtaxorder', esc_html__('About', 'custom-taxonomy-order-ne'), esc_html__('About', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder-about', 'customtaxorder_about');
73
+
74
  }
75
  add_action('admin_menu', 'customtaxorder_menu');
76
 
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.3.1
7
  Author: Marcel Pol
8
  Author URI: https://timelord.nl/
9
  License: GPLv2 or later
@@ -106,11 +106,11 @@ function customtaxorder_apply_order_filter( $orderby, $args ) {
106
  return 't.term_order';
107
  } else if ( $args['orderby'] == 'name' ) {
108
  return 't.name';
109
- } else if ( $options[$taxonomy] == 1 && ! isset($_GET['orderby']) ) {
110
  return 't.term_order';
111
- } else if ( $options[$taxonomy] == 2 && ! isset($_GET['orderby']) ) {
112
  return 't.name';
113
- } else if ( $options[$taxonomy] == 3 && ! isset($_GET['orderby']) ) {
114
  return 't.slug';
115
  } else {
116
  return $orderby;
@@ -183,7 +183,7 @@ function customtaxorder_wp_get_object_terms_order_filter( $terms ) {
183
  if ( ! isset ( $options[$taxonomy] ) ) {
184
  $options[$taxonomy] = 0; // default if not set in options yet
185
  }
186
- if ( $options[$taxonomy] == 1 && ! isset($_GET['orderby']) ) {
187
 
188
  // no filtering so the test in wp_generate_tag_cloud() works out right for us
189
  // filtering will happen in the tag_cloud_sort filter sometime later
@@ -271,7 +271,7 @@ function customtaxorder_order_categories( $categories ) {
271
  if ( ! isset( $options['category'] ) ) {
272
  $options['category'] = 0; // default if not set in options yet
273
  }
274
- if ( $options['category'] == 1 && ! isset($_GET['orderby']) ) {
275
  usort($categories, 'customtax_cmp');
276
 
277
  $terms_new_order = $categories;
@@ -311,6 +311,47 @@ function customtaxorder_get_taxonomies() {
311
  }
312
 
313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  /*
315
  * Function called at activation time.
316
  */
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.3.2
7
  Author: Marcel Pol
8
  Author URI: https://timelord.nl/
9
  License: GPLv2 or later
106
  return 't.term_order';
107
  } else if ( $args['orderby'] == 'name' ) {
108
  return 't.name';
109
+ } else if ( $options[$taxonomy] == 1 && ! customtaxorder_is_get_orderby_set() ) {
110
  return 't.term_order';
111
+ } else if ( $options[$taxonomy] == 2 && ! customtaxorder_is_get_orderby_set() ) {
112
  return 't.name';
113
+ } else if ( $options[$taxonomy] == 3 && ! customtaxorder_is_get_orderby_set() ) {
114
  return 't.slug';
115
  } else {
116
  return $orderby;
183
  if ( ! isset ( $options[$taxonomy] ) ) {
184
  $options[$taxonomy] = 0; // default if not set in options yet
185
  }
186
+ if ( $options[$taxonomy] == 1 && ! customtaxorder_is_get_orderby_set() ) {
187
 
188
  // no filtering so the test in wp_generate_tag_cloud() works out right for us
189
  // filtering will happen in the tag_cloud_sort filter sometime later
271
  if ( ! isset( $options['category'] ) ) {
272
  $options['category'] = 0; // default if not set in options yet
273
  }
274
+ if ( $options['category'] == 1 && ! customtaxorder_is_get_orderby_set() ) {
275
  usort($categories, 'customtax_cmp');
276
 
277
  $terms_new_order = $categories;
311
  }
312
 
313
 
314
+ /*
315
+ * Check if the GET parameter orderby is set.
316
+ * In case it is set it is assumed it is used to order terms, instead of posts, users, or anything else.
317
+ *
318
+ * @return bool true if the parameter is set. false if not set or if overridden by a filter.
319
+ *
320
+ * @since 3.3.2
321
+ */
322
+ function customtaxorder_is_get_orderby_set() {
323
+
324
+ $get_orderby_set = false;
325
+
326
+ if ( isset( $_GET['orderby'] ) ) {
327
+ $get_orderby_set = true;
328
+ }
329
+
330
+ /*
331
+ * Add filter to possible ignore the orderby parameter in the case that is set in the GET request.
332
+ * Might be usefull if your _GET parameter for orderby is used to sort posts, users, or just anything that is not terms.
333
+ *
334
+ * @param bool true if the orderby parameter in the GET request is set.
335
+ * @return bool always return false in case you want to ignore this GET parameter.
336
+ *
337
+ * @since 3.3.2
338
+ *
339
+ * Example code for using the filter:
340
+ *
341
+ * function my_customtaxorder_is_get_orderby_set( $get_orderby_set ) {
342
+ * return false; // ignore orderby GET parameter
343
+ * // return $get_orderby_set; // this would be default behaviour
344
+ * }
345
+ * add_filter( 'customtaxorder_is_get_orderby_set', 'my_customtaxorder_is_get_orderby_set' );
346
+ *
347
+ */
348
+ $get_orderby_set = (bool) apply_filters( 'customtaxorder_is_get_orderby_set', $get_orderby_set );
349
+
350
+ return $get_orderby_set;
351
+
352
+ }
353
+
354
+
355
  /*
356
  * Function called at activation time.
357
  */
lang/custom-taxonomy-order-ne-de_DE.mo DELETED
Binary file
lang/custom-taxonomy-order-ne-de_DE.po DELETED
@@ -1,118 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: Custom Taxonomy Order NE 2.5.9\n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2015-02-28 16:25+0100\n"
11
- "PO-Revision-Date: 2015-02-28 16:33+0100\n"
12
- "Last-Translator: Patrick Skiebe <patrick@skie.be>\n"
13
- "Language-Team: \n"
14
- "Language: de_DE\n"
15
- "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=UTF-8\n"
17
- "Content-Transfer-Encoding: 8bit\n"
18
- "X-Generator: Poedit 1.7.4\n"
19
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
- "X-Poedit-Basepath: .\n"
21
- "X-Poedit-KeywordsList: __;_e\n"
22
- "X-Poedit-SearchPath-0: ..\n"
23
-
24
- #: ../customtaxorder.php:61
25
- msgid "Term Order"
26
- msgstr "Begriffs&shy;reihenfolge"
27
-
28
- #: ../customtaxorder.php:63 ../customtaxorder.php:186
29
- msgid "Order "
30
- msgstr "Reihenfolge "
31
-
32
- #: ../customtaxorder.php:112
33
- msgid "Cheatin&#8217; uh?"
34
- msgstr "Zugriff verweigert!"
35
-
36
- #: ../customtaxorder.php:128
37
- msgid ""
38
- "The ordering of categories and custom taxonomy terms through a simple drag-"
39
- "and-drop interface."
40
- msgstr ""
41
- "Die Sortierung von Kategorien und Begriffen eigener Taxonomien über eine "
42
- "einfache Drag and Drop Oberfläche."
43
-
44
- #: ../customtaxorder.php:130
45
- msgid "Go to the plugin's Homepage"
46
- msgstr "Die Homepage des Plugins besuchen"
47
-
48
- #: ../customtaxorder.php:137
49
- msgid "Taxonomies"
50
- msgstr "Taxonomien"
51
-
52
- #: ../customtaxorder.php:155
53
- msgid "Order by ID (default)."
54
- msgstr "Sortierung nach ID (Standard)."
55
-
56
- #: ../customtaxorder.php:156
57
- msgid "Custom Order as defined above."
58
- msgstr "Eigene Reihenfolge, wie oben festgelegt."
59
-
60
- #: ../customtaxorder.php:157
61
- msgid "Alphabetical Order."
62
- msgstr "Alphabetische Sortierung."
63
-
64
- #: ../customtaxorder.php:201
65
- msgid ""
66
- "Order the taxonomies by dragging and dropping them into the desired order."
67
- msgstr ""
68
- "Sortieren Sie die Taxonomien, indem Sie sie mittels Drag and Drop an die "
69
- "gewünschte Position ziehen."
70
-
71
- #: ../customtaxorder.php:211
72
- msgid "Return to Parent"
73
- msgstr "Zum Elternelement"
74
-
75
- #: ../customtaxorder.php:215
76
- msgid "Update Order"
77
- msgstr "Reihenfolge aktualisieren"
78
-
79
- #: ../customtaxorder.php:216
80
- msgid "Sort Alphabetical"
81
- msgstr "Alphabetisch sortieren"
82
-
83
- #: ../customtaxorder.php:225
84
- msgid "Sub-"
85
- msgstr "Unter-"
86
-
87
- #: ../customtaxorder.php:225
88
- msgid "Choose a term from the drop down to order its sub-terms."
89
- msgstr ""
90
- "Wählen Sie einen Begriff aus der Liste, um dessen Unterbegriffe zu sortieren."
91
-
92
- #: ../customtaxorder.php:230
93
- msgid "Order Sub-terms"
94
- msgstr "Unterbegriffe sortieren"
95
-
96
- #: ../customtaxorder.php:236
97
- msgid "No terms found"
98
- msgstr "Keine Begriffe gefunden"
99
-
100
- #: ../customtaxorder.php:243 ../customtaxorder.php:481
101
- msgid "Settings"
102
- msgstr "Einstellungen"
103
-
104
- #: ../customtaxorder.php:246
105
- msgid "Auto-Sort Queries of this Taxonomy"
106
- msgstr "Abfragen dieser Taxonomie automatisch sortieren"
107
-
108
- #: ../customtaxorder.php:254
109
- msgid "Save Settings"
110
- msgstr "Einstellungen speichern"
111
-
112
- #: ../customtaxorder.php:348
113
- msgid "Order updated successfully."
114
- msgstr "Reihenfolge erfolgreich aktualisiert."
115
-
116
- #: ../customtaxorder.php:351
117
- msgid "An error occured, order has not been saved."
118
- msgstr "Ein Fehler ist aufgetreten, die Reihenfolge wurde nicht gespeichert."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/custom-taxonomy-order-ne-fr_FR.mo DELETED
Binary file
lang/custom-taxonomy-order-ne-fr_FR.po DELETED
@@ -1,117 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: Custom Taxonomy Order NE\n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2014-08-06 14:49+0200\n"
11
- "PO-Revision-Date: 2014-05-13 10:58+0100\n"
12
- "Last-Translator: Jean-Christophe Brebion <pro@jcbrebion.com>\n"
13
- "Language-Team: Jean-Christophe Brebion <pro@jcbrebion.com>\n"
14
- "Language: fr_FR\n"
15
- "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=UTF-8\n"
17
- "Content-Transfer-Encoding: 8bit\n"
18
- "X-Generator: Poedit 1.6.5\n"
19
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
20
- "X-Poedit-SourceCharset: UTF-8\n"
21
-
22
- #: customtaxorder.php:61
23
- msgid "Term Order"
24
- msgstr "Ordre"
25
-
26
- #: customtaxorder.php:63 customtaxorder.php:176
27
- msgid "Order "
28
- msgstr "Ordre des "
29
-
30
- #: customtaxorder.php:118
31
- msgid ""
32
- "The ordering of categories and custom taxonomy terms through a simple drag-"
33
- "and-drop interface."
34
- msgstr ""
35
-
36
- #: customtaxorder.php:120
37
- msgid "Go to the plugin's Homepage"
38
- msgstr ""
39
-
40
- #: customtaxorder.php:127
41
- msgid "Taxonomies"
42
- msgstr ""
43
-
44
- #: customtaxorder.php:145
45
- msgid "Order by ID (default)."
46
- msgstr "Ordre par ID (par défaut)."
47
-
48
- #: customtaxorder.php:146
49
- msgid "Custom Order as defined above."
50
- msgstr "Ordre personnalisé (tel que défini ci-dessus)."
51
-
52
- #: customtaxorder.php:147
53
- msgid "Alphabetical Order."
54
- msgstr "Ordre alphabétique."
55
-
56
- #: customtaxorder.php:191
57
- msgid ""
58
- "Order the taxonomies by dragging and dropping them into the desired order."
59
- msgstr ""
60
- "Triez les taxonomies en effectuant un glissé-déposé des termes dans l'ordre "
61
- "souhaité."
62
-
63
- #: customtaxorder.php:201
64
- msgid "Return to Parent"
65
- msgstr "Retour au Parent"
66
-
67
- #: customtaxorder.php:205
68
- msgid "Update Order"
69
- msgstr "Mettre à jour"
70
-
71
- #: customtaxorder.php:206
72
- msgid "Sort Alphabetical"
73
- msgstr "Tri alphabétique"
74
-
75
- #: customtaxorder.php:215
76
- msgid "Sub-"
77
- msgstr "Sous-"
78
-
79
- #: customtaxorder.php:215
80
- msgid "Choose a term from the drop down to order its sub-terms."
81
- msgstr ""
82
- "Choisissez un terme dans la liste déroulante pour ordonner ses termes "
83
- "enfants."
84
-
85
- #: customtaxorder.php:220
86
- msgid "Order Sub-terms"
87
- msgstr "Ordre des termes enfants"
88
-
89
- #: customtaxorder.php:226
90
- msgid "No terms found"
91
- msgstr "Aucun terme trouvé."
92
-
93
- #: customtaxorder.php:233 customtaxorder.php:465
94
- msgid "Settings"
95
- msgstr "Réglages"
96
-
97
- #: customtaxorder.php:236
98
- msgid "Auto-Sort Queries of this Taxonomy"
99
- msgstr "Tri automatique des requêtes pour cette Taxonomie."
100
-
101
- #: customtaxorder.php:244
102
- msgid "Save Settings"
103
- msgstr "Enregistrer les réglages"
104
-
105
- #: customtaxorder.php:337
106
- msgid "Order updated successfully."
107
- msgstr "Ordre mis à jour avec succès."
108
-
109
- #: customtaxorder.php:339
110
- msgid "An error occured, order has not been saved."
111
- msgstr "Une erreur s'est produite, l'ordre n'a pas été enregistré."
112
-
113
- #~ msgid "Order Categories"
114
- #~ msgstr "Ordre des Catégories"
115
-
116
- #~ msgid "Categories"
117
- #~ msgstr "Catégories"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/custom-taxonomy-order-ne-it_IT.mo DELETED
Binary file
lang/custom-taxonomy-order-ne-it_IT.po DELETED
@@ -1,121 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: Custom Taxonomy Order NE -2.3.1\n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2014-08-06 14:49+0200\n"
11
- "PO-Revision-Date: 2014-01-03 11:16+0100\n"
12
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
- "Language-Team: Matteo Boria <matteo@8-p.it>\n"
14
- "Language: it\n"
15
- "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=UTF-8\n"
17
- "Content-Transfer-Encoding: 8bit\n"
18
- "X-Generator: Poedit 1.6.3\n"
19
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
- "X-Poedit-SourceCharset: UTF-8\n"
21
-
22
- #: customtaxorder.php:61
23
- msgid "Term Order"
24
- msgstr "Ordina Categorie"
25
-
26
- #: customtaxorder.php:63 customtaxorder.php:176
27
- msgid "Order "
28
- msgstr "Ordina "
29
-
30
- #: customtaxorder.php:118
31
- msgid ""
32
- "The ordering of categories and custom taxonomy terms through a simple drag-"
33
- "and-drop interface."
34
- msgstr ""
35
-
36
- #: customtaxorder.php:120
37
- msgid "Go to the plugin's Homepage"
38
- msgstr ""
39
-
40
- #: customtaxorder.php:127
41
- msgid "Taxonomies"
42
- msgstr ""
43
-
44
- #: customtaxorder.php:145
45
- msgid "Order by ID (default)."
46
- msgstr ""
47
-
48
- #: customtaxorder.php:146
49
- msgid "Custom Order as defined above."
50
- msgstr ""
51
-
52
- #: customtaxorder.php:147
53
- msgid "Alphabetical Order."
54
- msgstr ""
55
-
56
- #: customtaxorder.php:191
57
- msgid ""
58
- "Order the taxonomies by dragging and dropping them into the desired order."
59
- msgstr ""
60
- "Ordina le tassonomie trascinandole (<em>drag&drop</em>) nell'ordine voluto"
61
-
62
- #: customtaxorder.php:201
63
- msgid "Return to Parent"
64
- msgstr "Torna al genitore "
65
-
66
- #: customtaxorder.php:205
67
- msgid "Update Order"
68
- msgstr "Aggiorna l'ordine"
69
-
70
- #: customtaxorder.php:206
71
- msgid "Sort Alphabetical"
72
- msgstr ""
73
-
74
- #: customtaxorder.php:215
75
- msgid "Sub-"
76
- msgstr "Sotto-"
77
-
78
- #: customtaxorder.php:215
79
- msgid "Choose a term from the drop down to order its sub-terms."
80
- msgstr "Seleziona un termine dalla tendina per ordinare i suoi sotto-termini."
81
-
82
- #: customtaxorder.php:220
83
- msgid "Order Sub-terms"
84
- msgstr "Ordina i Sotto-termini"
85
-
86
- #: customtaxorder.php:226
87
- msgid "No terms found"
88
- msgstr "Nessun termine trovato"
89
-
90
- #: customtaxorder.php:233 customtaxorder.php:465
91
- msgid "Settings"
92
- msgstr ""
93
-
94
- #: customtaxorder.php:236
95
- msgid "Auto-Sort Queries of this Taxonomy"
96
- msgstr ""
97
-
98
- #: customtaxorder.php:244
99
- msgid "Save Settings"
100
- msgstr "Salva i settaggi"
101
-
102
- #: customtaxorder.php:337
103
- msgid "Order updated successfully."
104
- msgstr "Ordinamento aggiornato correttamente"
105
-
106
- #: customtaxorder.php:339
107
- msgid "An error occured, order has not been saved."
108
- msgstr "Si è verificato un errore, ordine non salvato."
109
-
110
- #~ msgid "Order Categories"
111
- #~ msgstr "Ordina le Categorie"
112
-
113
- #~ msgid ""
114
- #~ "Check this box if you want to enable Automatic Sorting of all instances "
115
- #~ "from this taxonomy."
116
- #~ msgstr ""
117
- #~ "Spunta se vuoi attivare l'Ordinamento Automatico di tutte le voci in "
118
- #~ "questa tassonomia"
119
-
120
- #~ msgid "Auto-Sort Queries"
121
- #~ msgstr "Queries di auto-ordinamento"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/custom-taxonomy-order-ne-pl_PL.mo DELETED
Binary file
lang/custom-taxonomy-order-ne-pl_PL.po DELETED
@@ -1,121 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: Custom Taxonomy Order NE\n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2014-08-06 14:49+0200\n"
11
- "PO-Revision-Date: 2014-03-24 10:33+0100\n"
12
- "Last-Translator: \n"
13
- "Language-Team: Webidea.pl <paweldata@webidea.pl>\n"
14
- "Language: pl_PL\n"
15
- "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=UTF-8\n"
17
- "Content-Transfer-Encoding: 8bit\n"
18
- "X-Generator: Poedit 1.6.4\n"
19
- "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
20
- "|| n%100>=20) ? 1 : 2);\n"
21
- "X-Poedit-SourceCharset: UTF-8\n"
22
-
23
- #: customtaxorder.php:61
24
- msgid "Term Order"
25
- msgstr "Kolejność terminów"
26
-
27
- #: customtaxorder.php:63 customtaxorder.php:176
28
- msgid "Order "
29
- msgstr "Sortuj "
30
-
31
- #: customtaxorder.php:118
32
- msgid ""
33
- "The ordering of categories and custom taxonomy terms through a simple drag-"
34
- "and-drop interface."
35
- msgstr ""
36
-
37
- #: customtaxorder.php:120
38
- msgid "Go to the plugin's Homepage"
39
- msgstr ""
40
-
41
- #: customtaxorder.php:127
42
- msgid "Taxonomies"
43
- msgstr ""
44
-
45
- #: customtaxorder.php:145
46
- msgid "Order by ID (default)."
47
- msgstr "Sortuj po ID (domyślnie)."
48
-
49
- #: customtaxorder.php:146
50
- msgid "Custom Order as defined above."
51
- msgstr "Własna kolejność zdefiniowana powyżej."
52
-
53
- #: customtaxorder.php:147
54
- msgid "Alphabetical Order."
55
- msgstr "Kolejność alfabetyczna."
56
-
57
- #: customtaxorder.php:191
58
- msgid ""
59
- "Order the taxonomies by dragging and dropping them into the desired order."
60
- msgstr "Sortuj terminy za pomocą metody przeciągnij i upuść."
61
-
62
- #: customtaxorder.php:201
63
- msgid "Return to Parent"
64
- msgstr "Powróć do rodzica"
65
-
66
- #: customtaxorder.php:205
67
- msgid "Update Order"
68
- msgstr "Zapisz kolejność"
69
-
70
- #: customtaxorder.php:206
71
- msgid "Sort Alphabetical"
72
- msgstr "Sortuj alfabetycznie"
73
-
74
- #: customtaxorder.php:215
75
- msgid "Sub-"
76
- msgstr "Pod-"
77
-
78
- #: customtaxorder.php:215
79
- msgid "Choose a term from the drop down to order its sub-terms."
80
- msgstr "Wybierz termin z listy rozwijanej aby sortować terminy podrzędne"
81
-
82
- #: customtaxorder.php:220
83
- msgid "Order Sub-terms"
84
- msgstr "Sortuj terminy podrzędne"
85
-
86
- #: customtaxorder.php:226
87
- msgid "No terms found"
88
- msgstr "Nie znaleziono żadnego terminu"
89
-
90
- #: customtaxorder.php:233 customtaxorder.php:465
91
- msgid "Settings"
92
- msgstr ""
93
-
94
- #: customtaxorder.php:236
95
- msgid "Auto-Sort Queries of this Taxonomy"
96
- msgstr "Włącz funkcję Auto-Sort dla zapytań dla tej taksonomii"
97
-
98
- #: customtaxorder.php:244
99
- msgid "Save Settings"
100
- msgstr "Zapisz ustawienia"
101
-
102
- #: customtaxorder.php:337
103
- msgid "Order updated successfully."
104
- msgstr "Kolejność zapisana."
105
-
106
- #: customtaxorder.php:339
107
- msgid "An error occured, order has not been saved."
108
- msgstr "Wystąpił błąd podczas zapisywania kolejności."
109
-
110
- #~ msgid "Order Categories"
111
- #~ msgstr "Sortuj kategorie"
112
-
113
- #~ msgid ""
114
- #~ "Check this box if you want to enable Automatic Sorting of all instances "
115
- #~ "from this taxonomy."
116
- #~ msgstr ""
117
- #~ "Zaznacz to pole jeśli chcesz aby ta kolejność była wymuszona dla "
118
- #~ "wszystkich instacji tej taksonomii"
119
-
120
- #~ msgid "Auto-Sort Queries"
121
- #~ msgstr "Zapytania auto-sortowania"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
page-customtaxorder.php CHANGED
@@ -48,7 +48,7 @@ function customtaxorder_subpage() {
48
  <div id="icon-customtaxorder"></div>
49
 
50
  <?php
51
- if ( $this_page == 'customtaxorder' ) {
52
  // Main admin page with just a set of links to the taxonomy pages.
53
  ?>
54
  <h1>Custom Taxonomy Order</h1>
@@ -61,7 +61,15 @@ function customtaxorder_subpage() {
61
  echo '<li class="lineitem"><a href="' . admin_url( 'admin.php?page=customtaxorder-taxonomies' ) . '">' . esc_html__('Taxonomies', 'custom-taxonomy-order-ne') . '</a></li>
62
  ';
63
  foreach ( $taxonomies as $taxonomy ) {
64
- echo '<li class="lineitem"><a href="' . esc_url( admin_url( 'admin.php?page=customtaxorder-' . $taxonomy->name ) ) . '">' . esc_html( $taxonomy->label ) . '</a> &nbsp;(' . esc_html( $taxonomy->name ) . ')</li>
 
 
 
 
 
 
 
 
65
  ';
66
  }
67
  }
@@ -78,17 +86,19 @@ function customtaxorder_subpage() {
78
  $options[$taxonomy->name] = 0; // default if not set in options yet
79
  }
80
  if ( $this_page == $com_page ) {
81
- $settings .= '<label><input type="radio" name="customtaxorder_settings" value="0" ' . checked('0', $options[$taxonomy->name], false) . ' /> ' . esc_html__('Order by ID (default).', 'custom-taxonomy-order-ne') . '</label><br />
 
 
 
 
 
82
  ';
83
- $settings .= '<label><input type="radio" name="customtaxorder_settings" value="1" ' . checked('1', $options[$taxonomy->name], false) . ' /> ' . esc_html__('Custom Order as defined above.', 'custom-taxonomy-order-ne') . '</label><br />
84
  ';
85
- $settings .= '<label><input type="radio" name="customtaxorder_settings" value="2" ' . checked('2', $options[$taxonomy->name], false) . ' /> ' . esc_html__('Alphabetical Order by name.', 'custom-taxonomy-order-ne') . '</label><br />
86
  ';
87
- $settings .= '<label><input type="radio" name="customtaxorder_settings" value="3" ' . checked('3', $options[$taxonomy->name], false) . ' /> ' . esc_html__('Alphabetical Order by slug.', 'custom-taxonomy-order-ne') . '</label><br />
88
  ';
89
- $tax_label = $taxonomy->label;
90
- $tax_name = $taxonomy->name;
91
-
92
  $settings .= '<input name="customtaxorder_taxname" type="hidden" value="' . esc_attr( $tax_name ) . '" />';
93
  }
94
  }
48
  <div id="icon-customtaxorder"></div>
49
 
50
  <?php
51
+ if ( $this_page === 'customtaxorder' ) {
52
  // Main admin page with just a set of links to the taxonomy pages.
53
  ?>
54
  <h1>Custom Taxonomy Order</h1>
61
  echo '<li class="lineitem"><a href="' . admin_url( 'admin.php?page=customtaxorder-taxonomies' ) . '">' . esc_html__('Taxonomies', 'custom-taxonomy-order-ne') . '</a></li>
62
  ';
63
  foreach ( $taxonomies as $taxonomy ) {
64
+ $tax_label = $taxonomy->label;
65
+ if ( ! isset( $tax_label ) || strlen( $tax_label ) === 0 ) {
66
+ $tax_label = $taxonomy->name;
67
+ }
68
+ $tax_name = $taxonomy->name;
69
+ echo '
70
+ <li class="lineitem">
71
+ <a href="' . esc_url( admin_url( 'admin.php?page=customtaxorder-' . $tax_name ) ) . '">' . esc_html( $tax_label ) . '</a> &nbsp;(' . esc_html( $tax_name ) . ')
72
+ </li>
73
  ';
74
  }
75
  }
86
  $options[$taxonomy->name] = 0; // default if not set in options yet
87
  }
88
  if ( $this_page == $com_page ) {
89
+ $tax_label = $taxonomy->label;
90
+ if ( ! isset( $tax_label ) || strlen( $tax_label ) === 0 ) {
91
+ $tax_label = $taxonomy->name;
92
+ }
93
+ $tax_name = $taxonomy->name;
94
+ $settings .= '<label><input type="radio" name="customtaxorder_settings" value="0" ' . checked('0', $options[$tax_name], false) . ' /> ' . esc_html__('Order by ID (default).', 'custom-taxonomy-order-ne') . '</label><br />
95
  ';
96
+ $settings .= '<label><input type="radio" name="customtaxorder_settings" value="1" ' . checked('1', $options[$tax_name], false) . ' /> ' . esc_html__('Custom Order as defined above.', 'custom-taxonomy-order-ne') . '</label><br />
97
  ';
98
+ $settings .= '<label><input type="radio" name="customtaxorder_settings" value="2" ' . checked('2', $options[$tax_name], false) . ' /> ' . esc_html__('Alphabetical Order by name.', 'custom-taxonomy-order-ne') . '</label><br />
99
  ';
100
+ $settings .= '<label><input type="radio" name="customtaxorder_settings" value="3" ' . checked('3', $options[$tax_name], false) . ' /> ' . esc_html__('Alphabetical Order by slug.', 'custom-taxonomy-order-ne') . '</label><br />
101
  ';
 
 
 
102
  $settings .= '<input name="customtaxorder_taxname" type="hidden" value="' . esc_attr( $tax_name ) . '" />';
103
  }
104
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mpol
3
  Tags: term order, category order, taxonomy order, order
4
  Requires at least: 3.7
5
- Tested up to: 5.8
6
- Stable tag: 3.3.1
7
  License: GPLv2 or later
8
 
9
 
@@ -135,7 +135,7 @@ You could add the following example to your functions.php and work from there.
135
  add_action('customtaxorder_update_order', 'custom_action');
136
  ?>
137
 
138
- 'customtaxorder_terms_ordered' is being run after term array has been ordered with usort.
139
  Please be aware that this can be triggered multiple times during a request.
140
  You could add the following example to your functions.php and work from there.
141
 
@@ -146,6 +146,22 @@ You could add the following example to your functions.php and work from there.
146
  add_action('customtaxorder_terms_ordered', 'custom_action', 10, 2);
147
  ?>
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  = How can I add my own translation? =
150
 
151
  Translations can be added very easily through [GlotPress](https://translate.wordpress.org/projects/wp-plugins/custom-taxonomy-order-ne).
@@ -163,6 +179,15 @@ The left metabox lists the toplevel terms. Right (or below) are the sub-terms.
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
 
 
 
166
  = 3.3.1 =
167
  * 2021-11-26
168
  * Bring back removed code for orderby clause in 'get_terms_orderby' filter.
2
  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.3.2
7
  License: GPLv2 or later
8
 
9
 
135
  add_action('customtaxorder_update_order', 'custom_action');
136
  ?>
137
 
138
+ 'customtaxorder_terms_ordered' action is being run after term array has been ordered with usort.
139
  Please be aware that this can be triggered multiple times during a request.
140
  You could add the following example to your functions.php and work from there.
141
 
146
  add_action('customtaxorder_terms_ordered', 'custom_action', 10, 2);
147
  ?>
148
 
149
+ = I use the GET parameter 'orderby' to order posts, but then it is ignoring term order =
150
+
151
+ In case the GET parameter 'orderby' is set it is assumed it is used to order terms, instead of posts, users, or anything else.
152
+
153
+ You can add a filter to possible ignore the orderby parameter in the case that is set in the GET request.
154
+ That might be usefull if your GET parameter for orderby is used to sort posts, users, or just anything that is not terms.
155
+ Example code for using the filter:
156
+
157
+ <?php
158
+ function my_customtaxorder_is_get_orderby_set( $get_orderby_set ) {
159
+ return false; // ignore orderby GET parameter
160
+ // return $get_orderby_set; // this would be default behaviour
161
+ }
162
+ add_filter( 'customtaxorder_is_get_orderby_set', 'my_customtaxorder_is_get_orderby_set' );
163
+ ?>
164
+
165
  = How can I add my own translation? =
166
 
167
  Translations can be added very easily through [GlotPress](https://translate.wordpress.org/projects/wp-plugins/custom-taxonomy-order-ne).
179
 
180
  == Changelog ==
181
 
182
+ = 3.3.2 =
183
+ * 2021-12-24
184
+ * Add function 'customtaxorder_is_get_orderby_set'.
185
+ * Add filter 'customtaxorder_is_get_orderby_set' to optionally change the output of that function.
186
+ * Fix warning on PHP 8.1.
187
+ * Show taxonomy name as label on dashboard, if label is not set.
188
+ * Remove old translation files from plugin, GlotPress should be used.
189
+ * Do not show all submenu items on dashboard if they are over 100 (fix for Woo attributes).
190
+
191
  = 3.3.1 =
192
  * 2021-11-26
193
  * Bring back removed code for orderby clause in 'get_terms_orderby' filter.
taxonomies.php CHANGED
@@ -41,8 +41,15 @@ function custom_taxonomy_order() {
41
  <div class="misc-pub-section">
42
  <ul id="custom-taxonomy-list">
43
  <?php
44
- foreach ( $taxonomies_ordered as $taxonomy ) { ?>
45
- <li id="<?php echo esc_attr( $taxonomy->name ); ?>" class="lineitem"><?php echo esc_html( $taxonomy->label ) . ' &nbsp;(' . esc_html( $taxonomy->name ) . ')';?></li>
 
 
 
 
 
 
 
46
  <?php
47
  } ?>
48
  </ul>
41
  <div class="misc-pub-section">
42
  <ul id="custom-taxonomy-list">
43
  <?php
44
+ foreach ( $taxonomies_ordered as $taxonomy ) {
45
+ $tax_label = $taxonomy->label;
46
+ if ( ! isset( $tax_label ) || strlen( $tax_label ) === 0 ) {
47
+ $tax_label = $taxonomy->name;
48
+ }
49
+ $tax_name = $taxonomy->name;
50
+
51
+ ?>
52
+ <li id="<?php echo esc_attr( $tax_name ); ?>" class="lineitem"><?php echo esc_html( $tax_label ) . ' &nbsp;(' . esc_html( $tax_name ) . ')';?></li>
53
  <?php
54
  } ?>
55
  </ul>