Trước khi anh chi vào bài viết này nên xem qua bài viết Các khái niệm featured image, thumbnail, add image size là gì?
Một số code liên quan đến video:
1 |
remove_action("woocommerce_before_single_product_summary","woocommerce_show_product_images",20); |
1 2 3 4 5 |
function custom_get_featured_image(){ global $post; echo get_the_post_thumbnail(get_the_ID(), 'shop_single' ); } add_action("woocommerce_before_single_product_summary","custom_get_featured_image",20); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
add_filter( 'woocommerce_product_tabs', 'add_new_product_tab' ); function add_new_product_tab( $tabs ) { // Adds the new tab $tabs['hinh_anh_san_pham'] = array( 'title' => __( 'Hình ảnh sản phẩm', 'woocommerce' ), 'priority' => 50, 'callback' => 'tab_hinh_san_pham' ); return $tabs; } function tab_hinh_san_pham(){ global $post; $_product_image_gallery = get_post_meta($post->ID,"_product_image_gallery",true); $_product_image_gallerys = explode("," ,$_product_image_gallery); if($_product_image_gallerys): foreach($_product_image_gallerys as $id_image): //$post_thumbnail_id = get_post_thumbnail_id($id_image); $src_thumbnail =wp_get_attachment_image_src($id_image ,'full'); ?> <p> <?php //echo $id_image; ?> <img src="<?php echo $src_thumbnail[0]; ?>" /> </p> <?php endforeach; endif; } |
Mọi sự sao chép xin ghi rõ nguồn là fcwordpress.net
Chuyên trang về wordpress: hướng dẫn thiết kế theme, plugin, thủ thuật wordpress