Skip to content

Commit 2e19c7e

Browse files
committed
Added check/uncheck all checkbox in options
1 parent e4859ef commit 2e19c7e

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/code/class-i-order-terms.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,31 @@ public function settings_general_enable_sorting()
410410

411411
// fetch all taxonomies with standard WordPress UI that plugin supports
412412
$taxonomies = get_taxonomies( array( 'show_ui' => true ), 'objects' );
413+
414+
415+
// Show check/uncheck all
416+
if ( count( $taxonomies ) > 1 ) {
417+
?>
418+
419+
<label for="iorderterms-ctrl-all">
420+
<input id="iorderterms-ctrl-all" type="checkbox" onclick="iOrderTermsToggle(this)" />
421+
<span><?php echo esc_html_e( 'Check/uncheck all', 'i-order-terms' ); ?></span>
422+
<hr />
423+
</label>
424+
<br />
425+
<script>
426+
function iOrderTermsToggle(source) {
427+
var checkboxes = document.getElementsByName('iorderterms_general[taxonomies-sort][]');
428+
for ( var i = 0; i < checkboxes.length; i++) {
429+
checkboxes[i].checked = source.checked;
430+
}
431+
}
432+
</script>
433+
434+
<?php
435+
}
436+
437+
// List taxonomies
413438
foreach ( $taxonomies as $taxonomy ) {
414439
if ( $taxonomy->_builtin && in_array( $taxonomy->name, array( 'nav_menu' ) ) ) {
415440
continue;

src/readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: x64igor
33
Tags: sort, order, terms, taxonomy
44
Requires at least: 3.5
55
Tested up to: 4.7
6-
Stable tag: 1.4.0
6+
Stable tag: 1.5.0
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -78,6 +78,8 @@ Please make sure to include plugin version when reporting bugs.
7878
2. Settings section where you can select which taxonomy should be sortable.
7979

8080
== Changelog ==
81+
= 1.5.0 =
82+
* Added check/uncheck all checkbox in options
8183
= 1.4.0 =
8284
* Minified css and js assets
8385
* Fixed text domain usage
@@ -98,6 +100,8 @@ Please make sure to include plugin version when reporting bugs.
98100
* Initial release
99101

100102
== Upgrade Notice ==
103+
= 1.5.0 =
104+
* Added check/uncheck all checkbox in options
101105
= 1.4.0 =
102106
* Minified assets and fixed text domain usage
103107
= 1.3.1 =

0 commit comments

Comments
 (0)