WPML
add_filter( 'wcml_product_content_label', 'the_callback_function', 10, 2 );
เวอร์ชันของ WooCommerce Multilingual
3.6

คำอธิบาย

แก้ไขชื่อฟิลด์กำหนดเองในตัวแก้ไขการแปล WCML

อาร์กิวเมนต์

มีพารามิเตอร์สองตัวที่ส่งไปยังฟิลเตอร์นี้:
$meta_key
(string) คีย์ของฟิลด์ที่กำหนดเอง
$product_id
(integer) ID ของสินค้าต้นฉบับ

ตัวอย่างการใช้งาน

ตัวอย่าง
/*
 * 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

ฮุก การแทรกเนื้อหา ทั้งหมด 3 รายการ →