Fix for issue #21395
This commit is contained in:
parent
3d2b0ab72b
commit
f979b43b25
File diff suppressed because one or more lines are too long
|
@ -693,10 +693,9 @@
|
|||
}
|
||||
|
||||
.taxonomy-product_cat {
|
||||
.column-thumb .woocommerce-help-tip {
|
||||
.check-column .woocommerce-help-tip {
|
||||
font-size: 1.5em;
|
||||
margin: 0 0 0 -34px;
|
||||
padding: 0px 2px 5px;
|
||||
margin: -3px 0 0 5px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
}
|
||||
|
|
|
@ -18,10 +18,20 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
class WC_Admin_Taxonomies {
|
||||
|
||||
/**
|
||||
* Default category ID.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $default_cat_id = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
// Default category ID.
|
||||
$this->default_cat_id = get_option( 'default_product_cat', 0 );
|
||||
|
||||
// Category/term ordering
|
||||
add_action( 'create_term', array( $this, 'create_term' ), 5, 3 );
|
||||
add_action( 'delete_term', array( $this, 'delete_term' ), 5 );
|
||||
|
@ -54,6 +64,9 @@ class WC_Admin_Taxonomies {
|
|||
|
||||
// Maintain hierarchy of terms
|
||||
add_filter( 'wp_terms_checklist_args', array( $this, 'disable_checked_ontop' ) );
|
||||
|
||||
// Admin footer scripts for this product categories admin screen
|
||||
add_action( 'admin_footer', array( $this, 'scripts_at_product_cat_screen_footer' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -436,6 +449,25 @@ class WC_Admin_Taxonomies {
|
|||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin footer scripts for the product categories admin screen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function scripts_at_product_cat_screen_footer() {
|
||||
if ( ! isset( $_GET['taxonomy'] ) || 'product_cat' !== $_GET['taxonomy'] ) { // WPCS: ok
|
||||
return;
|
||||
}
|
||||
wc_enqueue_js("
|
||||
(function( $ ) {
|
||||
'use strict';
|
||||
var product_cat = $('tr#tag-" . $this->default_cat_id . "');
|
||||
product_cat.find('th').empty();
|
||||
product_cat.find('td.thumb span').detach('span').appendTo(product_cat.find('th'));
|
||||
})(jQuery);
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
new WC_Admin_Taxonomies();
|
||||
|
|
Loading…
Reference in New Issue