duancong6937 2015-09-15 02:23
浏览 33

加载WooCommerce产品更快

I am loading in products using a custom query (here is the code for it)

/* Load The Beast Balls Category */
$args = array(
    'post_type' => 'product',
    'posts_per_page' => 100,
    'product_cat' => 'beast-balls',
    //'orderby' => 'date',
    //'order' => 'desc'
    );
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
        <div class="product-node cat-beast-balls" id="cat-beast-balls">
        <?php wc_get_template_part( 'content', 'single-product' ); ?>
        </div>
    <?php endwhile;
}

wp_reset_postdata();

My problem is that the query grabs all of the products, and once it has done that it dumps them in the page.

Is there anyway to have them be dumped in the page one by one as they're loaded so that it appears as if they load quicker?

  • 写回答

1条回答 默认 最新

  • drlu11748 2015-09-17 05:11
    关注

    please use this plugin (http://codecanyon.net/item/infinite-ajax-scroll-woocommerce/9343295) loading product display on the page page refresh so display set product per page in plugin then after scrolling page then other product display by ajax.

    评论

报告相同问题?

悬赏问题

  • ¥15 制裁名单20240508芯片厂商
  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接