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

admin19/02/2024 2153

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 323
admin15/05/2025 319
admin13/05/2025 289
admin03/05/2025 405
admin03/05/2025 266
admin12/02/2025 824
admin11/02/2025 454
admin04/02/2025 442
Chia sẻ mới nhất
admin15/05/2025 319
admin13/05/2025 289
admin03/05/2025 405
admin03/05/2025 266
admin12/02/2025 824
admin11/02/2025 454
admin09/12/2024 615
_load_textdomain_just_in_time
admin21/11/2024 983
admin21/11/2024 770
admin20/11/2024 854
Tất cả dữ liệu trên website chỉ làm demo web tham khảo, không bán hàng hay cung cấp dịch vụ
';