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

admin19/02/2024 1918

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
admin12/02/2025 252
admin11/02/2025 137
admin04/02/2025 154
admin19/12/2024 180
admin19/12/2024 193
admin19/12/2024 214
admin09/12/2024 273
_load_textdomain_just_in_time
admin21/11/2024 439
Chia sẻ mới nhất
admin12/02/2025 252
admin11/02/2025 137
admin09/12/2024 273
_load_textdomain_just_in_time
admin21/11/2024 439
admin21/11/2024 393
admin20/11/2024 542
admin09/03/2024 2584
admin20/02/2024 1100
admin19/02/2024 1918
admin18/02/2024 1727