浏览代码

add archive template and posts-grid pattern (#5994)

* add archive template and posts-grid pattern

* update search template

* update search page with search box

* Update post-terms to category

Co-authored-by: Jeff Ong <jonger4@gmail.com>

* Stack terms and date.

* Reduce gap between post terms and date to 0.

* Remove text transform on the post terms.

Co-authored-by: Jeff Ong <jonger4@gmail.com>
Madhu Dollu 3 年之前
父节点
当前提交
8ee1e83a2c

+ 1 - 1
curator/patterns/404.php

@@ -15,4 +15,4 @@
 <p class="has-text-align-center"><?php echo esc_html__( 'This page could not be found. Try searching posts using the field below.', 'curator' ); ?></p>
 <!-- /wp:paragraph -->
 
-<!-- wp:search {"label":"","showLabel":false,"placeholder":"<?php echo esc_html__( 'Search', 'curator' ); ?>","buttonUseIcon":true,"borderColor":"foreground"} /-->
+<!-- wp:pattern {"slug":"curator/search-form"} /-->

+ 13 - 0
curator/patterns/hidden-post-terms-and-date.php

@@ -0,0 +1,13 @@
+<?php
+/**
+ * Title: Tags and date
+ * Slug: curator/post-terms-and-date
+ * Inserter: no
+ */
+
+?>
+
+<!-- wp:group {"style":{"spacing":{"blockGap":"0px"}},"layout":{"type":"flex","orientation":"vertical"}} -->
+<div class="wp-block-group"><!-- wp:post-terms {"term":"category"} /-->
+<!-- wp:post-date {"isLink":true,"style":{"typography":{"fontStyle":"italic","fontWeight":"400","fontSize":"14px"}}} /--></div>
+<!-- /wp:group -->

+ 10 - 0
curator/patterns/hidden-search-form.php

@@ -0,0 +1,10 @@
+<?php
+/**
+ * Title: Tags and date
+ * Slug: curator/search-form
+ * Inserter: no
+ */
+
+?>
+
+<!-- wp:search {"label":"","showLabel":false,"placeholder":"<?php echo esc_html__( 'Search', 'curator' ); ?>","buttonUseIcon":true,"borderColor":"foreground"} /-->

+ 28 - 0
curator/patterns/posts-grid.php

@@ -0,0 +1,28 @@
+<?php
+/**
+ * Title: Posts grid
+ * Slug: curator/posts-grid
+ * Categories: featured, query
+ */
+?>
+
+<!-- wp:group {"align":"full","layout":{"type":"flex","flexWrap":"nowrap"}} -->
+<div class="wp-block-group alignfull"><!-- wp:query {"queryId":0,"query":{"perPage":6,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true},"displayLayout":{"type":"flex","columns":3},"align":"wide"} -->
+<div class="wp-block-query alignwide"><!-- wp:post-template -->
+<!-- wp:group {"style":{"spacing":{"padding":{"top":"20px","right":"20px","bottom":"20px","left":"20px"}}},"layout":{"inherit":false}} -->
+<div class="wp-block-group" style="padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px">
+<!-- wp:post-featured-image {"isLink":true} /-->
+<!-- wp:pattern {"slug":"curator/post-terms-and-date"} /-->
+<!-- wp:post-title {"isLink":true,"textColor":"foreground"} /-->
+<!-- wp:post-excerpt {"style":{"spacing":{"margin":{"top":"0px","right":"0px","bottom":"0px","left":"0px"}}}} /-->
+</div>
+<!-- /wp:group -->
+<!-- /wp:post-template -->
+
+<!-- wp:query-pagination -->
+<!-- wp:query-pagination-previous /-->
+
+<!-- wp:query-pagination-next /-->
+<!-- /wp:query-pagination --></div>
+<!-- /wp:query --></div>
+<!-- /wp:group -->

+ 8 - 26
curator/templates/archive.html

@@ -1,33 +1,15 @@
 <!-- wp:template-part {"slug":"header","tagName":"header"} /-->
 
-<!-- wp:query {"tagName":"main","layout":{"inherit":true}} -->
-<main class="wp-block-query">
-<!-- wp:query-title {"type":"archive","style":{"spacing":{"margin":{"bottom":"100px"}}}} /-->
-<!-- wp:post-template -->
-<!-- wp:group -->
-<div class="wp-block-group">
-	<!-- wp:post-title {"isLink":true} /-->
-	<!-- wp:post-featured-image {"isLink":true} /-->
-	<!-- wp:post-excerpt /-->
-	<!-- wp:template-part {"slug":"post-meta","layout":{"inherit":true}} /-->
-	<!-- wp:spacer {"height":40} -->
-	<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
-	<!-- /wp:spacer -->
-</div>
-<!-- /wp:group -->
-<!-- /wp:post-template -->
-<!-- wp:group {"layout":{"inherit":true}} -->
-	<div class="wp-block-group">
-	<!-- wp:query-pagination -->
-		<!-- wp:query-pagination-previous /-->
-
-		<!-- wp:query-pagination-numbers /-->
+<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"3rem","bottom":"2.5rem"}}}} -->
+<main class="wp-block-group" style="padding-top:3rem;padding-bottom:2.5rem">
 
-		<!-- wp:query-pagination-next /-->
-	<!-- /wp:query-pagination -->
-	</div>
+	<!-- wp:group {"layout":{"inherit":true}} -->
+	<div class="wp-block-group"><!-- wp:query-title {"type":"archive","textAlign":"center","align":"wide","style":{"spacing":{"margin":{"bottom":"100px"}}}} /--></div>
 	<!-- /wp:group -->
+	
+	<!-- wp:pattern {"slug":"curator/posts-grid"} /-->
+
 </main>
-<!-- /wp:query -->
+<!-- /wp:group -->
 
 <!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->

+ 11 - 38
curator/templates/search.html

@@ -1,47 +1,20 @@
 <!-- wp:template-part {"slug":"header","tagName":"header"} /-->
 
-<!-- wp:group {"layout":{"inherit":true}} -->
-<div class="wp-block-group">
-	<!-- wp:search /-->
-
-	<!-- wp:spacer {"height":40} -->
-	<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
-	<!-- /wp:spacer -->
-</div>
-<!-- /wp:group -->
-
-<!-- wp:query {"layout":{"inherit":true}} -->
-<main class="wp-block-query">
-	<!-- wp:post-template -->
-	<!-- wp:group -->
-	<div class="wp-block-group">
-		<!-- wp:post-title {"isLink":true} /-->
-
-		<!-- wp:post-featured-image {"isLink":true} /-->
-
-		<!-- wp:post-excerpt /-->
-
-		<!-- wp:template-part {"slug":"post-meta","layout":{"inherit":true}} /-->
-
-		<!-- wp:spacer {"height":40} -->
-		<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
-		<!-- /wp:spacer -->
-	</div>
-	<!-- /wp:group -->
-	<!-- /wp:post-template -->
+<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"3rem","bottom":"2.5rem"}}}} -->
+<main class="wp-block-group" style="padding-top:3rem;padding-bottom:2.5rem">
 
 	<!-- wp:group {"layout":{"inherit":true}} -->
 	<div class="wp-block-group">
-		<!-- wp:query-pagination -->
-		<!-- wp:query-pagination-previous /-->
-
-		<!-- wp:query-pagination-numbers /-->
-
-		<!-- wp:query-pagination-next /-->
-		<!-- /wp:query-pagination -->
+	<!-- wp:pattern {"slug":"curator/search-form"} /-->
+	<!-- wp:spacer -->
+	<div style="height:4rem" aria-hidden="true" class="wp-block-spacer"></div>
+	<!-- /wp:spacer -->
 	</div>
 	<!-- /wp:group -->
+	
+	<!-- wp:pattern {"slug":"curator/posts-grid"} /-->
+
 </main>
-<!-- /wp:query -->
+<!-- /wp:group -->
 
-<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
+<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->

+ 60 - 1
curator/theme.json

@@ -231,12 +231,42 @@
 					"fontSize": "var(--wp--preset--font-size--medium)"
 				}
 			},
+			"core/post-terms": {
+				"elements": {
+					"link": {
+						"color": {
+							"text": "var(--wp--preset--color--foreground)"
+						},
+						"typography": {
+							"textDecoration": "none",
+							"fontWeight":"700"
+						}
+					}
+				}
+			},
 			"core/post-date": {
 				"color": {
 					"text": "var(--wp--preset--color--foreground)"
 				},
 				"typography": {
 					"fontSize": "var(--wp--preset--font-size--small)"
+				},
+				"elements": {
+					"link": {
+						"color": {
+							"text": "var(--wp--preset--color--foreground)"
+						},
+						"typography": {
+							"textDecoration": "none"
+						}
+					}
+				}
+			},
+			"core/post-featured-image": {
+				"spacing": {
+					"padding": {
+						"bottom": "1rem"
+					}
 				}
 			},
 			"core/post-title": {
@@ -245,9 +275,38 @@
 						"bottom": "0"
 					}
 				},
+				"color": {
+					"text": "var(--wp--preset--color--foreground)"
+				},
 				"typography": {
 					"fontFamily": "var(--wp--preset--font-family--heading-font)",
-					"lineHeight": "1.125"
+					"lineHeight": "1.125",
+					"textDecoration": "none"
+				},
+				"elements": {
+					"link": {
+						"color": {
+							"text": "var(--wp--preset--color--foreground)"
+						},
+						"typography": {
+							"textDecoration": "none"
+						}
+					}
+				}
+			},
+			"core/query-pagination": {
+				"spacing": {
+					"padding": {
+						"left": "20px",
+						"right": "20px"
+					}
+				},
+				"elements": {
+					"link": {
+						"color": {
+							"text": "var(--wp--preset--color--foreground)"
+						}
+					}
 				}
 			},
 			"core/pullquote": {