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

admin19/02/2024 587

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
admin05/05/2024 70
admin05/05/2024 31
admin30/04/2024 69
admin26/03/2024 147
admin09/03/2024 266
admin20/02/2024 218
admin19/02/2024 587
admin18/02/2024 499
Chia sẻ mới nhất
admin09/03/2024 266
admin20/02/2024 218
admin19/02/2024 587
admin18/02/2024 499
admin01/02/2024 276
admin31/01/2024 222
admin21/01/2024 226
admin21/01/2024 228
admin18/01/2024 277
admin16/01/2024 224