Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.