Đoạn này để show gallery ra trang shop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//* Add gallery thumbs to woocommerce shop page add_action('woocommerce_shop_loop_item_title','wps_add_extra_product_thumbs',5); function wps_add_extra_product_thumbs() { if ( is_shop() ) { global $product; $attachment_ids = $product->get_gallery_attachment_ids(); echo '<div class="product-thumbs">'; foreach( array_slice( $attachment_ids,0,3 ) as $attachment_id ) { $thumbnail_url = wp_get_attachment_image_src( $attachment_id,'thumbnail' )[0]; echo '<img class="thumb" src="' . $thumbnail_url . '">'; } echo '</div>'; } } |
Bài viết mới:
- Cách đăng sản phẩm có nhiều biến thể (size màu sắc) trong woocommerce
- Tạo đồng hồ đếm ngược trong wordpress bằng PHP – JavaScript Countdown Clock
- Count Up Number trên themes Flatsome như thế nào?
- Khắc phục lỗi image file unicode wordpress – clear image file name wordpress
- Mẫu banner miễn phí 2020 cực đẹp – Phần 2