Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Replace template strings with translatable patterns #182

Merged
merged 11 commits into from
Nov 2, 2021
5 changes: 2 additions & 3 deletions block-template-parts/footer.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"bottom":"var(--wp--custom--spacing--small, 1.25rem)","top":"var(--wp--custom--spacing--large, 8rem)"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:var(--wp--custom--spacing--large, 8rem);padding-bottom:var(--wp--custom--spacing--small, 1.25rem)"><!-- wp:site-title {"level":0} /-->

<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">Proudly Powered by <a href="https://wordpress.org" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- wp:pattern {"slug":"twentytwentytwo/general-credit"} /-->
</div>
<!-- /wp:group -->
16 changes: 3 additions & 13 deletions block-templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,9 @@

<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"right":"var(--wp--custom--spacing--small, 1.25rem)","left":"var(--wp--custom--spacing--small, 1.25rem)"}}}} -->
<main class="wp-block-group" style="padding-right:var(--wp--custom--spacing--small, 1.25rem);padding-left:var(--wp--custom--spacing--small, 1.25rem)"><!-- wp:group {"layout":{"inherit":true}} -->
<div class="wp-block-group"><!-- wp:heading {"style":{"typography":{"fontSize":"clamp(4rem, 40vw, 20rem)","fontWeight":"200","lineHeight":"1"}},"className":"has-text-align-center"} -->
<h2 class="has-text-align-center" style="font-size:clamp(4rem, 40vw, 20rem);font-weight:200;line-height:1">404</h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">This page could not be found.</p>
<!-- /wp:paragraph -->

<!-- wp:search {"label":"Search","showLabel":false,"width":50,"widthUnit":"%","buttonText":"Search","buttonUseIcon":true,"align":"center"} /-->

<!-- wp:spacer {"height":128} -->
<div style="height:128px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer --></div>
<div class="wp-block-group">
<!-- wp:pattern {"slug":"twentytwentytwo/general-404"} /-->
</div>
<!-- /wp:group --></main>
<!-- /wp:group -->

Expand Down
2 changes: 2 additions & 0 deletions inc/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function twentytwentytwo_register_block_patterns() {
'general-pricing-table',
'general-divider-light',
'general-divider-dark',
'general-credit',
'general-404',
'header-default',
'header-large-dark',
'header-with-tagline',
Expand Down
18 changes: 18 additions & 0 deletions inc/patterns/general-404.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* 404 content.
*/
return array(
'title' => __( '404 content', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-general' ),
'content' => '<!-- wp:heading {"style":{"typography":{"fontSize":"clamp(4rem, 40vw, 20rem)","fontWeight":"200","lineHeight":"1","spacing":{"margin":{"top":"0","bottom":"0"}}}},"className":"has-text-align-center"} -->
jffng marked this conversation as resolved.
Show resolved Hide resolved
<h2 class="has-text-align-center" style="font-size:clamp(4rem, 40vw, 20rem);font-weight:200;line-height:1;margin-top:0;margin-bottom:0;">404</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">' . esc_html( 'This page could not be found. Maybe try a search?', 'twentytwentytwo' ) . '</p>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented the suggestion from here #154 (comment)

<!-- /wp:paragraph -->
<!-- wp:search {"label":"Search","showLabel":false,"width":50,"widthUnit":"%","buttonText":"Search","buttonUseIcon":true,"align":"center"} /-->
<!-- wp:spacer {"height":128} -->
<div style="height:128px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->',
);
15 changes: 15 additions & 0 deletions inc/patterns/general-credit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Powered by WordPress credit line
*/
return array(
'title' => __( 'Powered by WordPress', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-general' ),
'content' => '<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' .
sprintf(
/* Translators: WordPress link. */
esc_html__( 'Proudly powered by %s', 'twentytwentytwo' ),
'<a href="' . esc_url( __( 'https://wordpress.org', 'twentytwentytwo' ) ) . '" rel="nofollow">WordPress</a>'
) . '</p>',
);