저는 woocommerce 제품 갤러리 용 슬라이더 작업을하고 있으며 탐색에 "점"을 사용하고 woocommerce 갤러리에서 생성 된 썸네일을 숨기거나 언로드하기 때문에 생성 된 썸네일을 사용 / 필요하지 않습니다.
먼저 내 테마 functions.php 파일 에 넣습니다 .
remove_theme_support( 'wc-product-gallery-slider' );
그리고 실제로 는 내 CSS 파일 에 "display : none" 을 넣고 product-thumbnails.php에 대해 다음과 같이 만듭니다 .
// Note: `wc_get_gallery_image_html` was added in WC 3.3.2 and did not exist prior. This check protects against theme overrides being used on older versions of WC.
if ( ! function_exists( 'wc_get_gallery_image_html' ) ) {
return;
}
global $post, $product;
$attachment_ids = $product->get_gallery_image_ids();
if ( $attachment_ids && $product->get_image_id() ) { ?>
<div class="slider product-responsive-thumbnail" id="product_thumbnail_<?php echo esc_attr( $post->ID ); ?>">
<?php foreach ( $attachment_ids as $attachment_id ) { ?>
<div class="thumbnail-wrapper">
<?php echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $attachment_id ), $attachment_id ); // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
</div>
<?php
} ?>
</div>
<?php
}
?>
페이지 로딩을 최적화하기 위해 썸네일 생성과 표시를 완전히 비활성화하고 싶습니다!
"produtc-thumbnails.php" 파일의 내용을 완전히 삭제할 수 있다는 것을 알고 있지만 약간의 원시 방법이며 다른 덜 원시 방법으로 이것이 가능한지 알고 싶습니다.
@ 7uc1f3r 이 나에게 제안 했듯이 ,
첫 번째 간단한 해결책. woocommerce-general.css 파일을 다음과 같이 마스크 하십시오.
.woocommerce div.product div.images .flex-control-thumbs {
overflow: hidden;
zoom: 1;
margin: 0;
padding:0;
display:none; /* this hide the thumbnails */
}
두 번째 해결책 은 product-thumbnails.php 에 " false "를 넣는 것입니다.
if ( ! function_exists( 'wc_get_gallery_image_html' ) ) {
return;
}
global $post, $product;
$attachment_ids = false; // This disable the thumbnails
이제 유지하려는 방법을 선택하는 것은 사용자의 몫입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다