Jelajahi Sumber

Archeo: Add Simple list of posts pattern (#5480)

* Add pattern

* Add custom CSS for alignment

* Update font styles

* Change to alignwide
Sarah Norris 3 tahun lalu
induk
melakukan
dc79e9c725

+ 1 - 0
archeo/inc/block-patterns.php

@@ -47,6 +47,7 @@ function archeo_register_block_patterns() {
 		'image-with-headline-and-description',
 		'image-with-description',
 		'layered-images-with-headline',
+		'simple-list-of-posts',
 		'layout-with-two-images-and-text',
 	);
 

+ 19 - 0
archeo/inc/patterns/simple-list-of-posts.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Simple list of posts
+ */
+return array(
+	'title'      => __( 'Simple list of posts', 'archeo' ),
+	'categories' => array( 'pages' ),
+	'content'    => '<!-- wp:group {"align":"wide"} -->
+	<div class="wp-block-group alignwide"><!-- wp:query {"queryId":3,"query":{"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false,"perPage":3}} -->
+	<div class="wp-block-query"><!-- wp:post-template -->
+	<!-- wp:group {"className":"simple-list-of-posts","layout":{"type":"flex","allowOrientation":false}} -->
+	<div class="wp-block-group simple-list-of-posts"><!-- wp:post-title {"style":{"typography":{"lineHeight":"1.2","fontStyle":"normal","fontWeight":"100"}},"fontSize":"huge"} /-->
+	
+	<!-- wp:post-author-name {"style":{"typography":{"fontStyle":"normal","fontWeight":"100","lineHeight":"1.2"}},"fontSize":"medium"} /--></div>
+	<!-- /wp:group -->
+	<!-- /wp:post-template --></div>
+	<!-- /wp:query --></div>
+	<!-- /wp:group -->',
+);

+ 7 - 0
archeo/style.css

@@ -179,4 +179,11 @@ body > .is-root-container > .wp-block-template-part > .wp-block-cover,
 .wp-block-post-comments input[type=submit].wp-block-button__link {
 	background-color: var(--wp--preset--color--background);
 	color: var(--wp--preset--color--foreground);
+}
+
+/*
+ * We need this until https://github.com/WordPress/gutenberg/issues/38498 is fixed.
+ */
+.wp-block-group.simple-list-of-posts {
+	align-items: baseline;
 }