WPML
add_filter( 'wcml_product_content_label', 'the_callback_function', 10, 2 );
Danh mục
Chèn nội dung
Phiên bản WooCommerce Multilingual
3.6

Miêu tả

Sửa đổi tên trường tùy chỉnh trong Trình biên tập dịch thuật WCML.

Đối số

Có hai tham số được truyền vào bộ lọc này:
$meta_key
(chuỗi văn bản) Khóa của trường tùy chỉnh.
$product_id
(số nguyên) ID của sản phẩm gốc.

Ví dụ sử dụng

Ví dụ
/*
 * Add this code to the functions.php file of your theme.
 */

add_filter( 'wcml_product_content_label', 'change_field_label', 10, 2 );

function change_field_label( $meta_key, $product_id ) {

	// Change the label of 'new_button_label' field in WCML Translation Editor 

	if ( $meta_key == 'new_button_label' ) {
		return __( 'Translate New Button Label', 'textdomain' );
	}

	return $meta_key;
}

wcml_after_duplicate_product, wcml_product_content_fields

Tất cả 3 hook Chèn nội dung →