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

admin19/02/2024 2059

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 129
admin15/05/2025 148
admin13/05/2025 133
admin03/05/2025 274
admin03/05/2025 139
admin12/02/2025 575
admin11/02/2025 311
admin04/02/2025 309
Chia sẻ mới nhất
admin15/05/2025 148
admin13/05/2025 133
admin03/05/2025 274
admin03/05/2025 139
admin12/02/2025 575
admin11/02/2025 311
admin09/12/2024 462
_load_textdomain_just_in_time
admin21/11/2024 806
admin21/11/2024 595
admin20/11/2024 715
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ụ
';