Stewart: fixes on index, archive and search templates (#5613)
* Stewart: archive template to update the query loop block in order to inherit query from template * Stewart: add posts list as pattern * Stewart: use posts list pattern in archive template * Stewart: use posts list pattern in index template * Stewart: use posts list pattern and add search block in search template * Change posts-list category to query Co-authored-by: Sarah Norris <sarah@sekai.co.uk>
This commit is contained in:
parent
f47fbf09d9
commit
fd1e51a9a9
5 changed files with 52 additions and 59 deletions
|
@ -14,10 +14,11 @@
|
|||
*/
|
||||
function stewart_register_block_patterns() {
|
||||
$block_pattern_categories = array(
|
||||
'footer' => array( 'label' => __( 'Footers', 'stewart' ) ),
|
||||
'header' => array( 'label' => __( 'Headers', 'stewart' ) ),
|
||||
'pages' => array( 'label' => __( 'Pages', 'stewart' ) ),
|
||||
'sidebar' => array( 'label' => __( 'Sidebars', 'stewart' ) ),
|
||||
'footer' => array( 'label' => __( 'Footers', 'stewart' ) ),
|
||||
'header' => array( 'label' => __( 'Headers', 'stewart' ) ),
|
||||
'pages' => array( 'label' => __( 'Pages', 'stewart' ) ),
|
||||
'sidebar' => array( 'label' => __( 'Sidebars', 'stewart' ) ),
|
||||
'query' => array( 'label' => __( 'Query', 'stewart' ) ),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -60,6 +61,7 @@ function stewart_register_block_patterns() {
|
|||
'sidebar-introduction',
|
||||
'sidebar-blogging',
|
||||
'sidebar-categories-tags',
|
||||
'posts-list',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
31
stewart/inc/patterns/posts-list.php
Normal file
31
stewart/inc/patterns/posts-list.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Posts list pattern
|
||||
*/
|
||||
return array(
|
||||
'title' => __( 'Posts list', 'stewart' ),
|
||||
'categories' => array( 'query' ),
|
||||
'content' => '<!-- wp:query {"queryId":3,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true},"displayLayout":{"type":"list","columns":2},"layout":{"inherit":false}} -->
|
||||
<div class="wp-block-query"><!-- wp:post-template -->
|
||||
<!-- wp:post-title {"isLink":true,"style":{"typography":{"lineHeight":"1.2"}},"fontSize":"huge"} /-->
|
||||
|
||||
<!-- wp:post-featured-image {"isLink":true} /-->
|
||||
|
||||
<!-- wp:post-excerpt {"fontSize":"normal"} /-->
|
||||
|
||||
<!-- wp:post-date {"isLink":true,"fontSize":"extra-small"} /-->
|
||||
|
||||
<!-- wp:spacer {"height":"60px"} -->
|
||||
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- /wp:post-template -->
|
||||
|
||||
<!-- wp:query-pagination -->
|
||||
<div class="wp-block-query-pagination"><!-- wp:query-pagination-previous /-->
|
||||
|
||||
<!-- wp:query-pagination-numbers /-->
|
||||
|
||||
<!-- wp:query-pagination-next /--></div>
|
||||
<!-- /wp:query-pagination --></div>
|
||||
<!-- /wp:query -->',
|
||||
);
|
|
@ -14,29 +14,9 @@
|
|||
<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
|
||||
<!-- wp:query {"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"displayLayout":{"type":"list","columns":2}} -->
|
||||
<div class="wp-block-query"><!-- wp:post-template -->
|
||||
<!-- wp:post-title {"isLink":true,"fontSize":"huge","style":{"typography":{"lineHeight":"1.2"}}} /-->
|
||||
<!-- wp:pattern {"slug":"stewart/posts-list"} /-->
|
||||
|
||||
<!-- wp:post-featured-image {"isLink":true} /-->
|
||||
|
||||
<!-- wp:post-excerpt {"fontSize":"normal"} /-->
|
||||
|
||||
<!-- wp:post-date {"isLink":true,"fontSize":"extra-small"} /-->
|
||||
|
||||
<!-- wp:spacer {"height":60} -->
|
||||
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- /wp:post-template -->
|
||||
|
||||
<!-- wp:query-pagination -->
|
||||
<div class="wp-block-query-pagination"><!-- wp:query-pagination-previous /-->
|
||||
|
||||
<!-- wp:query-pagination-numbers /-->
|
||||
|
||||
<!-- wp:query-pagination-next /--></div>
|
||||
<!-- /wp:query-pagination --></div>
|
||||
<!-- /wp:query --></main>
|
||||
</main>
|
||||
<!-- /wp:group --></div>
|
||||
<!-- /wp:column --></div>
|
||||
<!-- /wp:columns --></div>
|
||||
|
|
|
@ -8,29 +8,11 @@
|
|||
|
||||
<!-- wp:column {"width":"70%","style":{"spacing":{"padding":{"top":"0px","right":"0px","bottom":"0px","left":"0px"}}}} -->
|
||||
<div class="wp-block-column" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;flex-basis:70%"><!-- wp:group {"tagName":"main"} -->
|
||||
<main class="wp-block-group"><!-- wp:query {"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"displayLayout":{"type":"list","columns":2}} -->
|
||||
<div class="wp-block-query"><!-- wp:post-template -->
|
||||
<!-- wp:post-title {"isLink":true,"fontSize":"huge","style":{"typography":{"lineHeight":"1.2"}}} /-->
|
||||
|
||||
<!-- wp:post-featured-image {"isLink":true} /-->
|
||||
<main class="wp-block-group">
|
||||
<!-- wp:pattern {"slug":"stewart/posts-list"} /-->
|
||||
</main>
|
||||
|
||||
<!-- wp:post-excerpt {"fontSize":"normal"} /-->
|
||||
|
||||
<!-- wp:post-date {"isLink":true,"fontSize":"extra-small"} /-->
|
||||
|
||||
<!-- wp:spacer {"height":60} -->
|
||||
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- /wp:post-template -->
|
||||
|
||||
<!-- wp:query-pagination -->
|
||||
<div class="wp-block-query-pagination"><!-- wp:query-pagination-previous /-->
|
||||
|
||||
<!-- wp:query-pagination-numbers /-->
|
||||
|
||||
<!-- wp:query-pagination-next /--></div>
|
||||
<!-- /wp:query-pagination --></div>
|
||||
<!-- /wp:query --></main>
|
||||
<!-- /wp:group --></div>
|
||||
<!-- /wp:column --></div>
|
||||
<!-- /wp:columns --></div>
|
||||
|
|
|
@ -7,22 +7,20 @@
|
|||
<!-- /wp:column -->
|
||||
|
||||
<!-- wp:column {"width":"70%","style":{"spacing":{"padding":{"top":"0px","right":"0px","bottom":"0px","left":"0px"}}}} -->
|
||||
<div class="wp-block-column" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;flex-basis:70%"><!-- wp:group {"tagName":"main"} -->
|
||||
<main class="wp-block-group"><!-- wp:query {"queryId":1,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true}} -->
|
||||
<div class="wp-block-query">
|
||||
<!-- wp:post-template -->
|
||||
<div class="wp-block-column" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;flex-basis:70%">
|
||||
|
||||
<!-- wp:post-title {"level":5,"isLink":true} /-->
|
||||
<!-- wp:post-excerpt /-->
|
||||
<!-- wp:group {"tagName":"main"} -->
|
||||
|
||||
<!-- wp:spacer {"height":30} -->
|
||||
<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:search {"label":"Search","showLabel":false,"buttonText":"Search","backgroundColor":"foreground","textColor":"background"} /-->
|
||||
<!-- wp:spacer -->
|
||||
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<main class="wp-block-group">
|
||||
<!-- wp:pattern {"slug":"stewart/posts-list"} /-->
|
||||
</main>
|
||||
|
||||
<!-- /wp:post-template -->
|
||||
<!-- /wp:group -->
|
||||
</div>
|
||||
<!-- /wp:query --></main>
|
||||
<!-- /wp:group --></div>
|
||||
<!-- /wp:column --></div>
|
||||
<!-- /wp:columns --></div>
|
||||
<!-- /wp:group -->
|
||||
|
|
Loading…
Reference in a new issue