2017-12-10 22 views
0

나는 cusom shop 페이지가 있습니다. 카테고리에 따라 제품을 표시했습니다. 예를 들어 카테고리 이름은 자동차, 버스, 보트 등입니다woocommerce 제품 루프에 infinte 스크롤을 삽입하는 방법

그래서 내 맞춤 상점 페이지에서 다음 html을 작성합니다.

<div class="main-block"> 
<h2>car</h2> 
<p>Description</p> 
<?php echo do_shortcode('[products limit="50" columns="4" category="car"]'); ?>  
</div> 

<div class="main-block"> 
<h2>Bus</h2> 
<p>Description</p> 
<?php echo do_shortcode('[products limit="50" columns="4" category="bus"]'); ?>  
</div> 

<div class="main-block"> 
<h2>Boat</h2> 
<p>Description</p> 
<?php echo do_shortcode('[products limit="50" columns="4" category="boat"]'); ?> 
</div> 

모든 것이 정상적으로 작동하지만 페이지로드 시간이 증가하는 문제가 있습니다. 그래서 나는 load 메소드를 바꾸려고합니다. 각 카테고리에서 50 개 제품을 모두로드하는 대신 먼저 8 개 제품을로드 한 다음 사용자가 스크롤을 내린 다음 다른 제품을로드하십시오.

어떻게 코드를 수정할 수 있습니까? 도와주세요 .

누구든지 동일한 문제가 발생하면 해결하기 전에 도움을 받으십시오.

답변

0

이 문제를 해결하는 가장 빠른 방법은 당신이 경우 https://connekthq.com/plugins/ajax-load-more/docs/

또는

을 읽을 이상

[ajax_load_more post_type="product" columns="4" css_classes="products" posts_per_page="4" transition="fade" taxonomy="product_cat" taxonomy_terms="car" taxonomy_operator="IN" button_label=""] 

[products limit="50" columns="4" category="car"] 교체

https://wordpress.org/plugins/ajax-load-more/

및 사용 상세한 솔루션이 필요합니다.

https://code.tutsplus.com/tutorials/how-to-create-infinite-scroll-pagination--wp-24873