'main', 'footer' => 'page', 'posts_per_page' => '12', 'render' => array( $this, 'jetpack_infinite_scroll_loop' ), 'footer_widgets' => array( 'footer-1', 'footer-2', 'footer-3', 'footer-4', ), ) ) ); } /** * A loop used to display content appended using Jetpack infinite scroll * @return void */ public function jetpack_infinite_scroll_loop() { do_action( 'storefront_jetpack_infinite_scroll_before' ); if ( storefront_is_product_archive() ) { do_action( 'storefront_jetpack_product_infinite_scroll_before' ); woocommerce_product_loop_start(); } while ( have_posts() ) : the_post(); if ( storefront_is_product_archive() ) { wc_get_template_part( 'content', 'product' ); } else { get_template_part( 'content', get_post_format() ); } endwhile; // end of the loop. if ( storefront_is_product_archive() ) { woocommerce_product_loop_end(); do_action( 'storefront_jetpack_product_infinite_scroll_after' ); } do_action( 'storefront_jetpack_infinite_scroll_after' ); } /** * Adds columns wrapper to content appended by Jetpack infinite scroll * @return void */ public function jetpack_infinite_scroll_wrapper_columns() { add_action( 'storefront_jetpack_product_infinite_scroll_before', 'storefront_product_columns_wrapper' ); add_action( 'storefront_jetpack_product_infinite_scroll_after', 'storefront_product_columns_wrapper_close' ); } /** * Enqueue jetpack styles. * * @since 1.6.1 */ public function jetpack_scripts() { global $storefront_version; wp_enqueue_style( 'storefront-jetpack-style', get_template_directory_uri() . '/assets/sass/jetpack/jetpack.css', '', $storefront_version ); wp_style_add_data( 'storefront-jetpack-style', 'rtl', 'replace' ); } /** * Jetpack infinite scroll duplicates posts where orderby is anything other than modified or date * This filter offsets the products returned by however many are displayed per page * * @link https://github.com/Automattic/jetpack/issues/1135 * @param array $args infinite scroll args. * @return array infinite scroll args. */ public function fix_duplicate_products( $args ) { if ( ( isset( $args['post_type'] ) && 'product' === $args['post_type'] ) || ( isset( $args['taxonomy'] ) && 'product_cat' === $args['taxonomy'] ) ) { $args['offset'] = $args['posts_per_page'] * $args['paged']; } return $args; } } endif; return new Storefront_Jetpack();