Created
December 1, 2017 13:19
-
-
Save jeffikus/8b9dcfab1a3f32ed5e8886458b55abfa to your computer and use it in GitHub Desktop.
WooCommerce Jetpack Infinite Scroll example Part 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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