فهرست منبع

Dyad 2: Fixes Jetpack Infinite Scroll on WooCommerce pages

Danny Dudzic 7 سال پیش
والد
کامیت
5a77e59abc
5فایلهای تغییر یافته به همراه82 افزوده شده و 52 حذف شده
  1. 3 4
      dyad-2/inc/jetpack.php
  2. 0 30
      dyad-2/inc/woocommerce.php
  3. 1 1
      dyad-2/style.css
  4. 12 3
      dyad-2/woocommerce-rtl.css
  5. 66 14
      dyad-2/woocommerce.css

+ 3 - 4
dyad-2/inc/jetpack.php

@@ -28,7 +28,6 @@ if ( ! function_exists( 'dyad_2_jetpack' ) ) {
 			'footer_widgets' => array( 'sidebar-1'),
 			'render' => 'dyad_2_infinite_scroll_render',
 			'wrapper' => false,
-			'posts_per_page' => 12,
 		) );
 
 		//Content options
@@ -58,19 +57,19 @@ add_action( 'after_setup_theme', 'dyad_2_jetpack' );
  * Custom render function for Infinite Scroll.
  */
 function dyad_2_infinite_scroll_render() {
-	if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) {
+	if ( class_exists( 'WooCommerce' ) && ( dyad_2_woocommerce_is_shop_page() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) {
 		dyad_2_woocommerce_product_columns_wrapper();
 		woocommerce_product_loop_start();
 	}
 	while ( have_posts() ) {
 		the_post();
-		if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) :
+		if ( class_exists( 'WooCommerce' ) && ( dyad_2_woocommerce_is_shop_page() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) :
 			wc_get_template_part( 'content', 'product' );
 		else :
 			get_template_part( 'template-parts/content', 'blocks' );
 		endif;
 	}
-	if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) {
+	if ( class_exists( 'WooCommerce' ) && ( dyad_2_woocommerce_is_shop_page() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) {
 		woocommerce_product_loop_end();
 		dyad_2_woocommerce_product_columns_wrapper_close();
 	}

+ 0 - 30
dyad-2/inc/woocommerce.php

@@ -356,36 +356,6 @@ function dyad_2_woocommerce_is_shop_page() {
 	return $is_shop_page;
 }
 
-/**
- * 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.
- */
-function dyad_2_woocommerce_jetpack_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;
-}
-add_filter( 'infinite_scroll_query_args', 'dyad_2_woocommerce_jetpack_duplicate_products', 100 );
-
-/**
- * Override number of products per page in Jetpack infinite scroll.
- *
- * @param  array $args infinite scroll args.
- * @return array       infinite scroll args.
- */
-function dyad_2_woocommerce_jetpack_products_per_page( $args ) {
-	if ( is_array( $args ) && ( dyad_2_woocommerce_is_shop_page() || is_product_taxonomy() || is_product_category() || is_product_tag() ) ) {
-		 $args['posts_per_page'] = dyad_2_woocommerce_products_per_page();
-	}
-	return $args;
-}
-add_filter( 'infinite_scroll_settings', 'dyad_2_woocommerce_jetpack_products_per_page' );
-
 /**
  * Move the sale flash badge
  */

+ 1 - 1
dyad-2/style.css

@@ -4,7 +4,7 @@ Theme URI: http://wordpress.com/themes/dyad-2/
 Author: Automattic
 Author URI: http://wordpress.com/themes
 Description: Dyad pairs your written content and images together in perfect balance. The theme is geared towards photographers, foodies, artists, and anyone who is looking for a strong photographic presence on their website.
-Version: 2.0.5-wpcom
+Version: 2.0.6-wpcom
 License: GNU General Public License v2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 Tags: art, artwork, blog, blue, classic-menu, custom-colors, custom-header, custom-menu, dark, design, editor-style, featured-images, food, grid-layout, infinite-scroll, photoblogging, photography, post-slider, responsive-layout, rtl-language-support, site-logo, social-menu, sticky-post, threaded-comments, translation-ready, yellow

+ 12 - 3
dyad-2/woocommerce-rtl.css

@@ -286,6 +286,7 @@ p.no-comments {
 .woocommerce-noreviews .button,
 p.no-comments .button {
 	float: left;
+	margin-left: 0;
 	margin-right: 2em;
 }
 
@@ -314,6 +315,7 @@ p.no-comments .button {
 .product_list_widget a img {
 	float: right;
 	margin-left: 1em;
+	margin-right: 0;
 }
 
 /***
@@ -323,9 +325,6 @@ p.no-comments .button {
 	text-align: right;
 }
 
-
-
-
 /**
  * My Account
  **/
@@ -336,3 +335,13 @@ p.no-comments .button {
 .woocommerce-account .woocommerce-MyAccount-navigation ul {
 	margin-right: 0;
 }
+
+/**
+ * Checkout
+ */
+.woocommerce-cart #payment ul.payment_methods,
+.woocommerce #payment ul.payment_methods,
+#add_payment_method #payment ul.payment_methods,
+#shipping_method {
+	margin-right: 0;
+}

+ 66 - 14
dyad-2/woocommerce.css

@@ -60,6 +60,17 @@ table.shop_table td.actions .coupon input[type=text] {
 	padding: 0.875em;
 }
 
+table.shop_table tbody .wc-item-meta {
+	font-size: .875em;
+	margin: .875em 0 0 0;
+	list-style: none;
+}
+
+table.shop_table tbody .wc-item-meta p {
+	margin: 0;
+	padding: 0;
+}
+
 @media only screen and (max-width: 1200px) {
 	.has-post-thumbnail .shop_table .actions .coupon {
 		width: 50%;
@@ -275,6 +286,17 @@ ul.products li.product .button {
 	display: table;
 }
 
+dl.variation {
+	font-size: .875em;
+	margin: .875em 0 0 0;
+}
+
+dl.variation dd,
+dl.variation p {
+	margin: 0;
+	padding: 0;
+}
+
 @media screen and (min-width: 768px) {
 	body.woocommerce .products {
 		margin: 0 auto;
@@ -569,9 +591,10 @@ ul.products li.product .button {
 }
 
 .single-product .woocommerce-review-link {
-	display: inline-block;
+	display: block;
 	font-style: italic;
 	line-height: 1.618;
+	margin-bottom: 1em;
 	vertical-align: top;
 }
 
@@ -759,28 +782,28 @@ ul.order_details li strong {
  * General layout styles
  */
 .col2-set {
-  zoom: 1;
-  width: 100%;
+	zoom: 1;
+	width: 100%;
 }
 
 .col2-set::before,
 .col2-set::after {
-  content: ' ';
-  display: table;
+	content: ' ';
+	display: table;
 }
 
 .col2-set::after {
-  clear: both;
+	clear: both;
 }
 
 .col2-set .col-1 {
-  float: left;
-  width: 48%;
+	float: left;
+	width: 48%;
 }
 
 .col2-set .col-2 {
-  float: right;
-  width: 48%;
+	float: right;
+	width: 48%;
 }
 
 @media screen and (min-width: 768px) {
@@ -1085,13 +1108,13 @@ nav.woocommerce-pagination {
 }
 
 nav.woocommerce-pagination ul {
-  clear: both;
-  margin: 1em auto 2em auto;
+	clear: both;
+	margin: 1em auto 2em auto;
 }
 
 nav.woocommerce-pagination ul li {
-  display: inline-block;
-  padding: 0 0.25em;
+	display: inline-block;
+	padding: 0 0.25em;
 }
 
 nav.woocommerce-pagination ul li span.current {
@@ -1114,6 +1137,7 @@ nav.woocommerce-pagination ul li a:focus {
 	font-weight: 400;
 	height: 1.618em;
 	line-height: 1.618;
+	margin: 0 auto 1em;
 	overflow: hidden;
 	position: relative;
 	vertical-align: bottom;
@@ -1146,6 +1170,19 @@ nav.woocommerce-pagination ul li a:focus {
 	color: #678db8;
 }
 
+#reviews .star-rating,
+.summary .star-rating {
+	margin-bottom: 0;
+}
+
+.products .star-rating {
+	display: block;
+}
+
+.widget .star-rating {
+	margin: 0;
+}
+
 p.stars a {
 	position: relative;
 	height: 1em;
@@ -1299,6 +1336,10 @@ p.stars.selected a:not(.active):before {
 	padding-top: 0 !important;
 }
 
+.is-singular div.product .woocommerce-tabs .entry-content .shop_attributes p {
+	padding: 0;
+}
+
 .woocommerce-tabs .panel h2:first-of-type {
 	margin-bottom: 1em;
 }
@@ -1402,6 +1443,10 @@ p.no-comments {
 	position: relative;
 }
 
+.woocommerce-noreviews {
+	padding: 1em 2em 1em 2em;
+}
+
 @media screen and (max-width: 1080px) {
 	.woocommerce-message,
 	.woocommerce-info,
@@ -1542,6 +1587,13 @@ p.no-comments .button {
 	height: 100%;
 }
 
+.widget_rating_filter .wc-layered-nav-rating .star-rating {
+	display: inline-block;
+	height: 1em;
+	line-height: 1;
+	margin-bottom: 0.4em;
+}
+
 .product_list_widget li {
 	clear: both;
 }