Browse Source

Add a conditional pattern to so front-page can be used for both block list and page content

Jason Crist 2 years ago
parent
commit
6bb64189a4
2 changed files with 17 additions and 1 deletions
  1. 16 0
      loudness/patterns/front-page.php
  2. 1 1
      loudness/templates/front-page.html

+ 16 - 0
loudness/patterns/front-page.php

@@ -0,0 +1,16 @@
+<?php
+/**
+ * Title: Front Page
+ * Slug: loudness/front-page
+ */
+?>
+
+<?php
+if ( 'posts' === get_option( 'show_on_front' ) ) {
+	// Show query
+	echo( '<!-- wp:pattern {"slug":"loudness/posts-list"} /-->' );
+} else {
+	// show content
+	echo( '<!-- wp:post-content {"tagName":"main","layout":{"inherit":true},"lock":{"move":false,"remove":true}} /-->' );
+}
+

+ 1 - 1
loudness/templates/front-page.html

@@ -7,7 +7,7 @@
 	</div>
 	<!-- /wp:group -->
 
-	<!-- wp:post-content {"tagName":"main","layout":{"inherit":true},"lock":{"move":false,"remove":true}} /-->
+	<!-- wp:pattern {"slug":"loudness/front-page"} /-->	
 </div>
 <!-- /wp:group -->