Przeglądaj źródła

Remote: Remove hero from index template and make it a pattern (#5535)

* Remote: Add Hero as pattern and remove it from home template
Co-authored-by: Jason Crist <jcrist@pbking.com>
Matias Benedetto 3 lat temu
rodzic
commit
b2a94f5a0c

+ 6 - 2
remote/functions.php

@@ -159,6 +159,10 @@ endif;
 
 add_action( 'wp_head', 'remote_preload_webfonts' );
 
-// Add block patterns
-//require get_template_directory() . '/inc/block-patterns.php';
+/**
+ * Block Patterns.
+ */
+require get_template_directory() . '/inc/block-patterns.php';
+
+
 

+ 3 - 1
remote/inc/block-patterns.php

@@ -40,7 +40,9 @@ function remote_register_block_patterns() {
 		}
 	}
 
-	$block_patterns = array();
+	$block_patterns = array(
+		'hero-text',
+	);
 
 	/**
 	 * Filters the theme block patterns.

+ 21 - 0
remote/inc/patterns/hero-text.php

@@ -0,0 +1,21 @@
+<?php
+/**
+ * Hero text
+ */
+return array(
+	'title'      => __( 'Hero text', 'remote' ),
+	'categories' => array( 'pages' ),
+	'content'    => '<!-- wp:group {"align":"wide"} -->
+    <div class="wp-block-group alignwide"><!-- wp:spacer {"height":"32px"} -->
+    <div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
+    <!-- /wp:spacer -->
+    
+    <!-- wp:paragraph {"style":{"typography":{"lineHeight":"1.17"}},"fontSize":"huge"} -->
+    <p class="has-huge-font-size" style="line-height:1.17">' . esc_html__( 'Hi, I’m Tiffany! After years of long commutes and crowded offices, I’m now a happy advocate for remote work.', 'remote' ) . '</p>
+    <!-- /wp:paragraph -->
+    
+    <!-- wp:spacer -->
+    <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
+    <!-- /wp:spacer --></div>
+    <!-- /wp:group -->',
+);

+ 11 - 26
remote/templates/home.html

@@ -1,34 +1,23 @@
 <!-- wp:template-part {"slug":"header","tagName":"header"} /-->
 
 <!-- wp:group {"layout":{"inherit":true}} -->
-<div class="wp-block-group"><!-- wp:spacer {"height":32} -->
-	<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
-	<!-- /wp:spacer -->
-
-	<!-- wp:group {"align":"wide"} -->
-	<div class="wp-block-group alignwide">
-		<!-- wp:paragraph {"style":{"typography":{"lineHeight":"1.17"}},"fontSize":"huge"} -->
-		<p class="has-huge-font-size" style="line-height:1.17">Hi, I’m Tiffany! After years of long commutes and crowded offices, I’m now a happy advocate for remote work.</p>
-		<!-- /wp:paragraph -->
+	<div class="wp-block-group">
+	<!-- wp:pattern {"slug":"remote/hero-text"} /-->
+	</div>
+<!-- /wp:group -->
 
-		<!-- wp:spacer -->
-		<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
-		<!-- /wp:spacer --></div>
-	<!-- /wp:group -->
-
-	<!-- wp:group {"align":"full","layout":{"inherit":true}} -->
-	<div class="wp-block-group alignfull">
-	<!-- wp:query {"tagName":"main","align":"wide"} -->
+<!-- wp:group {"align":"full","layout":{"inherit":true}} -->
+<div class="wp-block-group alignfull"><!-- wp:query {"queryId":0,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"taxQuery":null},"tagName":"main","align":"wide"} -->
 	<main class="wp-block-query alignwide"><!-- wp:post-template -->
 	<!-- wp:separator {"className":"is-style-wide"} -->
 	<hr class="wp-block-separator is-style-wide"/>
 	<!-- /wp:separator -->
-
+	
 	<!-- wp:columns {"style":{"spacing":{"padding":{"top":"1em"}}}} -->
 	<div class="wp-block-columns" style="padding-top:1em"><!-- wp:column {"verticalAlignment":"top","width":"10%"} -->
 	<div class="wp-block-column is-vertically-aligned-top" style="flex-basis:10%"><!-- wp:post-date {"format":"M j","style":{"typography":{"textTransform":"uppercase"}},"fontSize":"small"} /--></div>
 	<!-- /wp:column -->
-
+	
 	<!-- wp:column {"verticalAlignment":"center","width":""} -->
 	<div class="wp-block-column is-vertically-aligned-center"><!-- wp:post-title {"isLink":true,"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}},"typography":{"fontSize":"clamp(3rem, 6vw, 4rem)"}}} /--></div>
 	<!-- /wp:column --></div>
@@ -38,16 +27,12 @@
 	<!-- wp:spacer {"height":"1.5em"} -->
 	<div style="height:1.5em" aria-hidden="true" class="wp-block-spacer"></div>
 	<!-- /wp:spacer -->
-
+	
 	<!-- wp:query-pagination -->
 	<!-- wp:query-pagination-previous /-->
-
-	<!-- wp:query-pagination-numbers /-->
-
 	<!-- wp:query-pagination-next /-->
 	<!-- /wp:query-pagination --></main>
 	<!-- /wp:query --></div>
-	<!-- /wp:group --></div>
-	<!-- /wp:group -->
+<!-- /wp:group -->
 
-	<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer-container","layout":{"inherit":true}} /-->
+<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer-container","layout":{"inherit":true}} /-->