Thêm đoạn code này vào cuối file functions.php:
Xoá tab bất kỳ
Sử dụng đoạn mã sau để xóa các tab cụ thể
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove product data tabs | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); | |
function woo_remove_product_tabs( $tabs ) { | |
unset( $tabs['description'] ); // Remove the description tab | |
unset( $tabs['reviews'] ); // Remove the reviews tab | |
unset( $tabs['additional_information'] ); // Remove the additional information tab | |
return $tabs; | |
} |
Đổi tên tab
Sử dụng đoạn mã sau để đổi tên tab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Rename product data tabs | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
function woo_rename_tabs( $tabs ) { | |
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab | |
$tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab | |
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab | |
return $tabs; | |
} |
Sắp xếp lại các tab
Sử dụng đoạn mã sau để thay đổi thứ tự tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Reorder product data tabs | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); | |
function woo_reorder_tabs( $tabs ) { | |
$tabs['reviews']['priority'] = 5; // Reviews first | |
$tabs['description']['priority'] = 10; // Description second | |
$tabs['additional_information']['priority'] = 15; // Additional information third | |
return $tabs; | |
} |
Tùy chỉnh một tab
Đoạn mã sau sẽ thay thế tab mô tả bằng chức năng tùy chỉnh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Customize product data tabs | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 ); | |
function woo_custom_description_tab( $tabs ) { | |
$tabs['description']['callback'] = 'woo_custom_description_tab_content'; // Custom description callback | |
return $tabs; | |
} | |
function woo_custom_description_tab_content() { | |
echo '<h2>Custom Description</h2>'; | |
echo '<p>Here\'s a custom description</p>'; | |
} |
Thêm một tab tùy chỉnh
Sử dụng đoạn mã sau để thêm tab sản phẩm toàn cầu tùy chỉnh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add a custom product data tab | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' ); | |
function woo_new_product_tab( $tabs ) { | |
// Adds the new tab | |
$tabs['test_tab'] = array( | |
'title' => __( 'New Product Tab', 'woocommerce' ), | |
'priority' => 50, | |
'callback' => 'woo_new_product_tab_content' | |
); | |
return $tabs; | |
} | |
function woo_new_product_tab_content() { | |
// The new tab content | |
echo '<h2>New Product Tab</h2>'; | |
echo '<p>Here\'s your new product tab.</p>'; | |
} |
Hướng dẫn sử dụng plugin All-in-One WP Migration and Backup
Plugin WP All-in-One Migration là một công cụ mạnh mẽ để sao lưu, di chuyển [...]
Th7
Bật mặc định cho phép đánh giá của WooCommerce
Chào bạn, trong trường hợp nào đó vô tình web bạn bị tắt cho phép [...]
Th1
Hướng dẫn Thêm / Thay đổi tabs sản phẩm của WooCommerce
Thêm đoạn code này vào cuối file functions.php: Xoá tab bất kỳ Sử dụng đoạn [...]
Th1
Cách vô hiệu hóa Lazy Load trong WordPress
Chào bạn, Kể từ WordPress 5.5 được phát hành vào ngày 11/8/2020 thì WordPress đã [...]
Th12
Hướng dẫn xoá bỏ size ảnh, fix lỗi ảnh bị mờ trên WordPress
Xin chào các bạn, trong bài viết này mình xin hướng dẫn cách xử lý [...]
Th12
Cách Fix Lỗi Redirect Loop Sau Khi Kích Hoạt SSL Của Cloudflare
Cloudflare là một dịch vụ hiệu suất và bảo mật có uy tín với Mạng [...]
Th12
How to get taxonomy/category direct children only
How to get taxonomy/category direct children only – Cách lấy chuyên mục/term con trực tiếp [...]
Th12