Skip to content

Commit

Permalink
Move default query into its own template part.
Browse files Browse the repository at this point in the history
- Tidy up the query itself.
- Fix wide/full styles for inner content in the query block.
  • Loading branch information
kjellr committed Dec 18, 2020
1 parent cbaa3dc commit f4a0131
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 103 deletions.
34 changes: 34 additions & 0 deletions tt1-blocks/block-template-parts/query.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!-- wp:query {"queryId":1,"query":{"perPage":"","pages":"","offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[2227],"sticky":"","inherit":true}} -->
<!-- wp:query-loop -->
<!-- wp:post-title {"isLink":true} /-->

<!-- wp:post-content /-->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:separator {"align":"center","className":"is-style-twentytwentyone-separator-thick"} -->
<hr class="wp-block-separator aligncenter is-style-twentytwentyone-separator-thick"/>
<!-- /wp:separator -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-date /-->

<!-- wp:post-author {"showAvatar":false} /--></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-hierarchical-terms {"term":"category","textAlign":"right"} /-->

<!-- wp:post-tags {"textAlign":"right"} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- /wp:query-loop -->
<!-- /wp:query -->
35 changes: 1 addition & 34 deletions tt1-blocks/block-templates/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,6 @@ <h1 class="alignwide">Archive</h1>
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:query {"queryId":1}} -->
<!-- wp:query-loop -->
<!-- wp:post-title {"isLink":true} /-->

<!-- wp:post-content /-->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:separator {"align":"center","className":"is-style-twentytwentyone-separator-thick"} -->
<hr class="wp-block-separator aligncenter is-style-twentytwentyone-separator-thick"/>
<!-- /wp:separator -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-date /-->

<!-- wp:post-author {"showAvatar":false} /--></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-hierarchical-terms {"term":"category","textAlign":"right"} /-->

<!-- wp:post-tags {"textAlign":"right"} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- /wp:query-loop -->
<!-- /wp:query -->
<!-- wp:template-part {"slug":"query","theme":"tt1-blocks","align":"full"} /-->

<!-- wp:template-part {"slug":"footer","theme":"tt1-blocks","align":"full","tagName":"footer","className":"site-footer"} /-->
35 changes: 1 addition & 34 deletions tt1-blocks/block-templates/index.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,5 @@
<!-- wp:template-part {"slug":"header","theme":"tt1-blocks","align":"full", "tagName":"header","className":"site-header"} /-->

<!-- wp:query {"queryId":1,"query":{"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","sticky":""}} -->
<!-- wp:query-loop -->
<!-- wp:post-title {"isLink":true} /-->

<!-- wp:post-content /-->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:separator {"align":"center","className":"is-style-twentytwentyone-separator-thick"} -->
<hr class="wp-block-separator aligncenter is-style-twentytwentyone-separator-thick"/>
<!-- /wp:separator -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-date /-->

<!-- wp:post-author {"showAvatar":false} /--></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-hierarchical-terms {"term":"category","textAlign":"right"} /-->

<!-- wp:post-tags {"textAlign":"right"} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- /wp:query-loop -->
<!-- /wp:query -->
<!-- wp:template-part {"slug":"query","theme":"tt1-blocks","align":"full"} /-->

<!-- wp:template-part {"slug":"footer","theme":"tt1-blocks","align":"full","tagName":"footer","className":"site-footer"} /-->
35 changes: 1 addition & 34 deletions tt1-blocks/block-templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,6 @@ <h1 class="alignwide">Search Results</h1>
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:query {"queryId":1} -->
<!-- wp:query-loop -->
<!-- wp:post-title {"isLink":true} /-->

<!-- wp:post-excerpt /-->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:separator {"align":"center","className":"is-style-twentytwentyone-separator-thick"} -->
<hr class="wp-block-separator aligncenter is-style-twentytwentyone-separator-thick"/>
<!-- /wp:separator -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-date /-->

<!-- wp:post-author {"showAvatar":false} /--></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:post-hierarchical-terms {"term":"category","textAlign":"right"} /-->

<!-- wp:post-tags {"textAlign":"right"} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- /wp:query-loop -->
<!-- /wp:query -->
<!-- wp:template-part {"slug":"query","theme":"tt1-blocks","align":"full"} /-->

<!-- wp:template-part {"slug":"footer","theme":"tt1-blocks","align":"full","tagName":"footer","className":"site-footer"} /-->
10 changes: 10 additions & 0 deletions tt1-blocks/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**
* Unused file.
*
* This file is only present to pass the Theme Check. It's not used by the theme.
*/
?>

<?php wp_footer(); ?>
</body>
15 changes: 15 additions & 0 deletions tt1-blocks/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Unused file.
*
* This file is only present to pass the Theme Check. It's not used by the theme.
*/
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php do_action( 'wp_body_open' ); ?>
3 changes: 2 additions & 1 deletion tt1-blocks/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ body {
}

.wp-site-blocks > *:not(.wp-block-post-content),
.wp-site-blocks .wp-block-post-content > * {
.wp-site-blocks .wp-block-post-content > *,
.wp-block-query-loop li > *:not(.entry-content):not(.alignwide):not(.alignfull) {
max-width: var(--wp--custom--responsive--aligndefault-width);
margin-left: auto;
margin-right: auto;
Expand Down

0 comments on commit f4a0131

Please sign in to comment.