Skip to content

Instantly share code, notes, and snippets.

@jeffikus
Created December 1, 2017 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffikus/8b9dcfab1a3f32ed5e8886458b55abfa to your computer and use it in GitHub Desktop.
Save jeffikus/8b9dcfab1a3f32ed5e8886458b55abfa to your computer and use it in GitHub Desktop.
WooCommerce Jetpack Infinite Scroll example Part 1
<?php
/**
* Custom render function for Infinite Scroll.
*/
function _s_infinite_scroll_render() {
if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) {
_s_woocommerce_product_columns_wrapper();
woocommerce_product_loop_start();
}
while ( have_posts() ) {
the_post();
if ( is_search() ) :
get_template_part( 'template-parts/content', 'search' );
elseif ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) :
wc_get_template_part( 'content', 'product' );
else :
get_template_part( 'template-parts/content', get_post_format() );
endif;
}
if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) {
woocommerce_product_loop_end();
_s_woocommerce_product_columns_wrapper_close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment