Skip to content

Commit

Permalink
Blockbase: make 404 into a php template so it can be translated (#4332)
Browse files Browse the repository at this point in the history
* Make 404 and search translatable.

* Remove heading from search template so the theme i18n ready.
  • Loading branch information
jffng authored Jul 27, 2021
1 parent 08bb63d commit ae7e63d
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 45 deletions.
24 changes: 24 additions & 0 deletions blockbase/404.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* The template for displaying 404 pages (not found)
*
* @package Blockbase
* @since 1.1.1
*/
wp_head();

echo gutenberg_block_template_part( 'header' );
?>

<main class="container-404">
<h1 class="has-text-align-center has-large-font-size"><?php _e( 'Oops! That page can&rsquo;t be found.', 'blockbase' ); ?></h1>

<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'blockbase' ); ?></p>

<?php echo do_blocks('<!-- wp:search {"label":""} /-->'); ?>
</main>

<?php
echo gutenberg_block_template_part( 'footer' );

wp_footer();
6 changes: 6 additions & 0 deletions blockbase/assets/ponyfill.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions blockbase/block-templates/404.html

This file was deleted.

4 changes: 0 additions & 4 deletions blockbase/block-templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
<!-- wp:group {"layout":{"inherit":true},"tagName":"main"} -->
<main class="wp-block-group">

<!-- wp:heading -->
<h2>Results:</h2>
<!-- /wp:heading -->

<!-- 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 -->
Expand Down
7 changes: 7 additions & 0 deletions blockbase/sass/base/_alignment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@
.aligncenter {
text-align: center;
}

// Mimick the Gutenberg-generated rules of the layout container on the 404 template
.container-404 {
max-width: var(--wp--custom--layout--content-size);
margin-left: auto !important;
margin-right: auto !important;
}
2 changes: 1 addition & 1 deletion blockbase/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: Blockbase is a simple theme that supports full-site editing. It com
Requires at least: 5.7
Tested up to: 5.7
Requires PHP: 5.7
Version: 1.1.0
Version: 1.1.1
License: GNU General Public License v2 or later
License URI: https://raw.githubusercontent.com/Automattic/themes/trunk/LICENSE
Text Domain: blockbase
Expand Down
3 changes: 3 additions & 0 deletions blockbase/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@
}
}
},
"layout": {
"contentSize": "620px"
},
"list": {
"spacing": {
"padding": {
Expand Down
18 changes: 0 additions & 18 deletions quadrat/block-templates/404.html

This file was deleted.

4 changes: 0 additions & 4 deletions quadrat/block-templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
<!-- wp:group {"layout":{"inherit":true}, "tagName":"main"} -->
<main class="wp-block-group">

<!-- wp:heading -->
<h2>Results:</h2>
<!-- /wp:heading -->

<!-- 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}} -->
<!-- wp:query-loop -->

Expand Down
3 changes: 3 additions & 0 deletions quadrat/child-theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@
"fontSize": "min(max(28px, 5vw), 38px)"
}
},
"layout": {
"contentSize":"664px"
},
"line-height": {
"body": 1.7
},
Expand Down
3 changes: 3 additions & 0 deletions quadrat/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@
}
}
},
"layout": {
"contentSize": "664px"
},
"list": {
"spacing": {
"padding": {
Expand Down

0 comments on commit ae7e63d

Please sign in to comment.