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

Commit

Permalink
Add footer patterns (#85)
Browse files Browse the repository at this point in the history
* Add header block patterns

* Remove empty paragraph block.

* Register title nav social pattern.

* Add text-only header with stacked tagline.

* Fix pattern slug.

* Reorder patterns, add missing comma.

* Use preset color variables for the social links block.

* Tidy up margin for stacked title/tagline patterns.

* Add additional patterns.

* Fix PHPCS errors.

* Fix PHPCS errors.

* Update all patterns to use a header tagName.

* Use links instead of two page lists.

* Add footer patterns.

* Fix names, content widths.

* Fix typo.

Co-authored-by: Jeff Ong <[email protected]>

* Remove tagNames to avoid duplication.

* Add missing pattern to array.

* Add missing escape/translation functions.

Co-authored-by: Jeff Ong <[email protected]>
  • Loading branch information
kjellr and jffng authored Oct 12, 2021
1 parent dc12671 commit 7214673
Show file tree
Hide file tree
Showing 13 changed files with 338 additions and 0 deletions.
16 changes: 16 additions & 0 deletions inc/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
if ( ! function_exists( 'twentytwentytwo_register_block_patterns' ) ) :
function twentytwentytwo_register_block_patterns() {
if ( function_exists( 'register_block_pattern_category' ) ) {
register_block_pattern_category(
'twentytwentytwo-footers',
array( 'label' => __( 'Twenty Twenty-Two Footers', 'twentytwentytwo' ) )
);
register_block_pattern_category(
'twentytwentytwo-headers',
array( 'label' => __( 'Twenty Twenty-Two Headers', 'twentytwentytwo' ) )
Expand All @@ -19,6 +23,18 @@ function twentytwentytwo_register_block_patterns() {
}
if ( function_exists( 'register_block_pattern' ) ) {
$block_patterns = array(
'footer-default',
'footer-dark',
'footer-logo',
'footer-navigation',
'footer-title-tagline-social',
'footer-title-tagline-social-dark',
'footer-social-copyright',
'footer-navigation-copyright',
'footer-about-title-logo',
'footer-query-title-citation',
'footer-query-images-title-citation',
'footer-blog',
'header-default',
'header-with-tagline',
'header-text-only-with-stacked-tagline',
Expand Down
32 changes: 32 additions & 0 deletions inc/patterns/footer-about-title-logo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Footer with text, title, and logo
*/
return array(
'title' => __( 'Footer with text, title, and logo', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"8rem","bottom":"6rem"}}},"backgroundColor":"secondary","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull has-secondary-background-color has-background" style="padding-top:8rem;padding-bottom:6rem"><!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"33%"} -->
<div class="wp-block-column" style="flex-basis:33%"><!-- wp:paragraph -->
<p>' . esc_html__( 'ABOUT US', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"style":{"fontSize":"small"} -->
<p class="has-small-font-size">' . esc_html__( 'We are a rogue collective of bird watchers. We’ve been known to sneak through fences, climb perimeter walls, and generally trespass in order to observe the rarest of birds.', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:spacer {"height":180} -->
<div style="height:180px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:site-title /--></div>
<!-- /wp:column -->
<!-- wp:column {"verticalAlignment":"bottom"} -->
<div class="wp-block-column is-vertically-aligned-bottom"><!-- wp:site-logo {"align":"right","width":60} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:group -->',
);
50 changes: 50 additions & 0 deletions inc/patterns/footer-blog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* Blog footer
*/
return array(
'title' => __( 'Blog footer', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"8rem","bottom":"8rem"}}},"layout":{"wideSize":"1000px"}} -->
<div class="wp-block-group alignfull" style="padding-top:8rem;padding-bottom:8rem"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>' . esc_html__( 'ABOUT US', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>' . esc_html__( 'We are a rogue collective of bird watchers. We’ve been known to sneak through fences, climb perimeter walls, and generally trespass in order to observe the rarest of birds.', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>' . esc_html__( 'LATEST POSTS', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:latest-posts /--></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>' . esc_html__( 'CATEGORIES', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:categories /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
<!-- wp:spacer {"height":50} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:site-title /-->
<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' . esc_html__( 'Proudly powered by ', 'twentytwentyone' ) . '<a href="' . esc_url( 'https://wordpress.org' ) . '" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
18 changes: 18 additions & 0 deletions inc/patterns/footer-dark.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Dark footer wtih title and citation
*/
return array(
'title' => __( 'Dark footer with title and citation)', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"0px","right":"0px","bottom":"0px","left":"0px"}},"elements":{"link":{"color":{"text":"var:preset|color|background"}}}},"backgroundColor":"foreground","textColor":"background","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull has-background-color has-foreground-background-color has-text-color has-background has-link-color" style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:site-title /-->
<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' . esc_html__( 'Proudly powered by ', 'twentytwentytwo' ) . '<a href="' . esc_url( 'https://wordpress.org' ) . '" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
18 changes: 18 additions & 0 deletions inc/patterns/footer-default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Default footer
*/
return array(
'title' => __( 'Default footer', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:site-title /-->
<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' . esc_html__( 'Proudly powered by ', 'twentytwentytwo' ) . '<a href="' . esc_url( 'https://wordpress.org' ) . '" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
18 changes: 18 additions & 0 deletions inc/patterns/footer-logo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Default footer with logo
*/
return array(
'title' => __( 'Footer with logo and citation', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:site-logo {"width":60} /-->
<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' . esc_html__( 'Proudly powered by ', 'twentytwentytwo' ) . '<a href="' . esc_url( 'https://wordpress.org' ) . '" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
22 changes: 22 additions & 0 deletions inc/patterns/footer-navigation-copyright.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Footer with navigation and copyright
*/
return array(
'title' => __( 'Footer with navigation and copyright', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:navigation {"itemsJustification":"center"} -->
<!-- wp:page-list {"isNavigationChild":true,"showSubmenuIcon":true,"openSubmenusOnClick":false} /-->
<!-- /wp:navigation -->
<!-- wp:spacer {"height":50} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"16px"}}} -->
<p class="has-text-align-center" style="font-size:16px">' . esc_html__( '© Site Title', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->',
);
20 changes: 20 additions & 0 deletions inc/patterns/footer-navigation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Footer with navigation and citation
*/
return array(
'title' => __( 'Footer with navigation and citation', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:navigation -->
<!-- wp:page-list {"isNavigationChild":true,"showSubmenuIcon":true,"openSubmenusOnClick":false} /-->
<!-- /wp:navigation -->
<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' . esc_html__( 'Proudly powered by ', 'twentytwentytwo' ) . '<a href="' . esc_url( 'https://wordpress.org' ) . '" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
34 changes: 34 additions & 0 deletions inc/patterns/footer-query-images-title-citation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Footer with query, featured images, title, and citation
*/
return array(
'title' => __( 'Footer with query, featured images, title, and citation', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}},"elements":{"link":{"color":{"text":"var:preset|color|background"}}}},"backgroundColor":"foreground","textColor":"background","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull has-background-color has-foreground-background-color has-text-color has-background has-link-color" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:query {"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"flex","columns":3},"align":"wide"} -->
<div class="wp-block-query alignwide"><!-- wp:post-template -->
<!-- wp:post-featured-image {"isLink":true,"width":"100%","height":"318px"} /-->
<!-- wp:post-title {"isLink":true,"fontSize":"large"} /-->
<!-- wp:post-excerpt /-->
<!-- wp:post-date {"format":"F j, Y","isLink":true,"fontSize":"small"} /-->
<!-- /wp:post-template --></div>
<!-- /wp:query -->
<!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:site-title /-->
<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' . esc_html__( 'Proudly powered by ', 'twentytwentytwo' ) . '<a href="' . esc_url( 'https://wordpress.org' ) . '" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
32 changes: 32 additions & 0 deletions inc/patterns/footer-query-title-citation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Footer with query, title, and citation
*/
return array(
'title' => __( 'Footer with query, title, and citation', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}},"elements":{"link":{"color":{"text":"var:preset|color|background"}}}},"backgroundColor":"primary","textColor":"background","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull has-background-color has-primary-background-color has-text-color has-background has-link-color" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:query {"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"flex","columns":3},"align":"wide"} -->
<div class="wp-block-query alignwide"><!-- wp:post-template -->
<!-- wp:post-title {"isLink":true,"fontSize":"large"} /-->
<!-- wp:post-excerpt /-->
<!-- wp:post-date /-->
<!-- /wp:post-template --></div>
<!-- /wp:query -->
<!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:site-title /-->
<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">' . esc_html__( 'Proudly powered by ', 'twentytwentytwo' ) . '<a href="' . esc_url( 'https://wordpress.org' ) . '" rel="nofollow">WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
26 changes: 26 additions & 0 deletions inc/patterns/footer-social-copyright.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Footer with social links and copyright
*/
return array(
'title' => __( 'Footer with social links and copyright', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:social-links {"iconColor":"foreground","iconColorValue":"var(--wp--preset--color--foreground)","iconBackgroundColor":"background","iconBackgroundColorValue":"var(--wp--preset--color--background)","layout":{"type":"flex","justifyContent":"center"}} -->
<ul class="wp-block-social-links has-icon-color has-icon-background-color"><!-- wp:social-link {"url":"#","service":"facebook"} /-->
<!-- wp:social-link {"url":"#","service":"twitter"} /-->
<!-- wp:social-link {"url":"#","service":"instagram"} /--></ul>
<!-- /wp:social-links -->
<!-- wp:spacer {"height":50} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"16px"}}} -->
<p class="has-text-align-center" style="font-size:16px">' . esc_html__( '© Site Title', 'twentytwentytwo' ) . '</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->',
);
26 changes: 26 additions & 0 deletions inc/patterns/footer-title-tagline-social-dark.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Footer with title, tagline, and social links
*/
return array(
'title' => __( 'Footer with title, tagline, and social links (Dark)', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","style":{"elements":{"link":{"color":{"text":"var:preset|color|background"}}}},"backgroundColor":"foreground","textColor":"background","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull has-background-color has-foreground-background-color has-text-color has-background has-link-color"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:group -->
<div class="wp-block-group"><!-- wp:site-title {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}},"typography":{"textTransform":"uppercase"}}} /-->
<!-- wp:site-tagline {"style":{"spacing":{"margin":{"top":"0.25em","bottom":"0px"}},"typography":{"fontStyle":"italic","fontWeight":"400"}},"fontSize":"small"} /--></div>
<!-- /wp:group -->
<!-- wp:social-links {"iconBackgroundColor":"foreground","iconBackgroundColorValue":"var(--wp--preset--color--foreground)","layout":{"type":"flex","justifyContent":"right"}} -->
<ul class="wp-block-social-links has-icon-background-color"><!-- wp:social-link {"url":"#","service":"facebook"} /-->
<!-- wp:social-link {"url":"#","service":"twitter"} /-->
<!-- wp:social-link {"url":"#","service":"instagram"} /--></ul>
<!-- /wp:social-links --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);
26 changes: 26 additions & 0 deletions inc/patterns/footer-title-tagline-social.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Footer with title, tagline, and social links
*/
return array(
'title' => __( 'Footer with title, tagline, and social links', 'twentytwentytwo' ),
'categories' => array( 'twentytwentytwo-footers' ),
'blockTypes' => array( 'core/template-part/footer' ),
'content' => '<!-- wp:group {"align":"full","layout":{"inherit":true}} -->
<div class="wp-block-group alignfull"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"4rem","bottom":"4rem"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:4rem;padding-bottom:4rem"><!-- wp:group -->
<div class="wp-block-group"><!-- wp:site-title {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}},"typography":{"textTransform":"uppercase"}}} /-->
<!-- wp:site-tagline {"style":{"spacing":{"margin":{"top":"0.25em","bottom":"0px"}},"typography":{"fontStyle":"italic","fontWeight":"400"}},"fontSize":"small"} /--></div>
<!-- /wp:group -->
<!-- wp:social-links {"iconColor":"foreground","iconColorValue":"var(--wp--preset--color--foreground)","iconBackgroundColor":"background","iconBackgroundColorValue":"var(--wp--preset--color--background)","layout":{"type":"flex","justifyContent":"right"}} -->
<ul class="wp-block-social-links has-icon-color has-icon-background-color"><!-- wp:social-link {"url":"#","service":"facebook"} /-->
<!-- wp:social-link {"url":"#","service":"twitter"} /-->
<!-- wp:social-link {"url":"#","service":"instagram"} /--></ul>
<!-- /wp:social-links --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->',
);

0 comments on commit 7214673

Please sign in to comment.