Show video trong chi tiết sản phẩm giao diện flatsome | Show video in Product Details

admin19/02/2024 1996

Trong chi tiết sản phẩm của giao diện flatsome có field nhập link video. Bạn muốn hiện field này theo vị trí mong muốn. Code dưới đây sẽ giúp bạn tạo shortcode cho nó. Bạn có thể dùng shortcode này để hiện ở bất kỳ vị trí nào trong trang chi tiết sản phẩm của mình.

English: In the product details of the Flatsome theme, there is a field for entering a video link. You want to display this field in a desired position. The following code will help you create a shortcode for it. You can use this shortcode to display it at any position on your product detail page.

Hãy chép đoạn code dưới đây vào file function và sử dụng shortcode: [flatsome_product_video_sanpham]  nhé:

English: Please copy the following code into the function file and use shortcode : [flatsome_product_video_sanpham]

 

function flatsome_product_video_sanpham() {
global $wc_cpdf;
$product_video_url = trim( $wc_cpdf->get_value( get_the_ID(), '_product_video' ) );
if ( ! empty( $product_video_url ) ) {
return flatsome_apply_shortcode( 'ux_video', array(
'url' => $product_video_url,
) );
}
return ''; 
}
add_shortcode( 'flatsome_product_video_sanpham', 'flatsome_product_video_sanpham' );

Kết quả:

 

Hỏi đáp

Bài viết mới nhất
admin20/05/2025 37
admin15/05/2025 46
admin13/05/2025 46
admin03/05/2025 194
admin03/05/2025 67
admin12/02/2025 407
admin11/02/2025 227
admin04/02/2025 247
Chia sẻ mới nhất
admin15/05/2025 46
admin13/05/2025 46
admin03/05/2025 194
admin03/05/2025 67
admin12/02/2025 407
admin11/02/2025 227
admin09/12/2024 364
_load_textdomain_just_in_time
admin21/11/2024 700
admin21/11/2024 499
admin20/11/2024 630