diff --git a/block-template-parts/header.html b/block-template-parts/header.html index 8b56b5e8..f68f1c0a 100644 --- a/block-template-parts/header.html +++ b/block-template-parts/header.html @@ -3,7 +3,7 @@
-
+ diff --git a/functions.php b/functions.php index 925b1f74..480bd729 100644 --- a/functions.php +++ b/functions.php @@ -70,3 +70,6 @@ function twentytwentytwo_get_font_face_styles() { "; } endif; + +// Add block patterns +require get_template_directory() . '/inc/block-patterns.php'; diff --git a/inc/block-patterns.php b/inc/block-patterns.php new file mode 100644 index 00000000..657ac885 --- /dev/null +++ b/inc/block-patterns.php @@ -0,0 +1,45 @@ + __( 'Twenty Twenty-Two Headers', 'twentytwentytwo' ) ) + ); + } + if ( function_exists( 'register_block_pattern' ) ) { + $block_patterns = array( + 'header-default', + 'header-with-tagline', + 'header-text-only-with-stacked-tagline', + 'header-text-only', + 'header-text-only-with-tagline', + 'header-text-only-all-caps-with-tagline', + 'header-logo-navigation', + 'header-logo-navigation-social', + 'header-title-navigation-social', + 'header-logo-navigation-offset-tagline', + 'header-stacked', + 'header-large-dark', + 'header-centered-logo', + 'header-centered-logo-in-navigation', + 'header-centered-title-navigation-social', + 'header-title-and-button', + ); + + foreach ( $block_patterns as $block_pattern ) { + register_block_pattern( + 'twentytwentytwo/' . $block_pattern, + require __DIR__ . '/patterns/' . $block_pattern . '.php' + ); + } + } + } +endif; +add_action( 'init', 'twentytwentytwo_register_block_patterns', 9 ); diff --git a/inc/patterns/header-centered-logo-in-navigation.php b/inc/patterns/header-centered-logo-in-navigation.php new file mode 100644 index 00000000..6b3e0fe0 --- /dev/null +++ b/inc/patterns/header-centered-logo-in-navigation.php @@ -0,0 +1,22 @@ + __( 'Header with centered Logo in Navigation', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+ + + + + + + + + +
+ ', +); diff --git a/inc/patterns/header-centered-logo.php b/inc/patterns/header-centered-logo.php new file mode 100644 index 00000000..64778c11 --- /dev/null +++ b/inc/patterns/header-centered-logo.php @@ -0,0 +1,26 @@ + __( 'Header with centered Logo', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+
+ + + +
+ + + +
+ +
+
+
+ ', +); diff --git a/inc/patterns/header-centered-title-navigation-social.php b/inc/patterns/header-centered-title-navigation-social.php new file mode 100644 index 00000000..c8cda51d --- /dev/null +++ b/inc/patterns/header-centered-title-navigation-social.php @@ -0,0 +1,30 @@ + __( 'Centered title with Navigation and Social Links Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+
+ +
+ + + +
+ + + +
+ +
+
+
+ ', +); diff --git a/inc/patterns/header-default.php b/inc/patterns/header-default.php new file mode 100644 index 00000000..be03f54d --- /dev/null +++ b/inc/patterns/header-default.php @@ -0,0 +1,21 @@ + __( 'Default Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+ + +
+ + + + +
+ ', +); diff --git a/inc/patterns/header-large-dark.php b/inc/patterns/header-large-dark.php new file mode 100644 index 00000000..4315a73c --- /dev/null +++ b/inc/patterns/header-large-dark.php @@ -0,0 +1,29 @@ + __( 'Large Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' + + ', +); diff --git a/inc/patterns/header-logo-navigation-offset-tagline.php b/inc/patterns/header-logo-navigation-offset-tagline.php new file mode 100644 index 00000000..e2790ca4 --- /dev/null +++ b/inc/patterns/header-logo-navigation-offset-tagline.php @@ -0,0 +1,28 @@ + __( 'Logo, Navigation, and offset Tagline Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+ + + +
+ + + +
+
+ + + +
+
+
+ ', +); diff --git a/inc/patterns/header-logo-navigation-social.php b/inc/patterns/header-logo-navigation-social.php new file mode 100644 index 00000000..75e85fe4 --- /dev/null +++ b/inc/patterns/header-logo-navigation-social.php @@ -0,0 +1,22 @@ + __( 'Logo, Navigation, and Social Links Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+ + + + + + + +
+ ', +); diff --git a/inc/patterns/header-logo-navigation.php b/inc/patterns/header-logo-navigation.php new file mode 100644 index 00000000..e3a448b3 --- /dev/null +++ b/inc/patterns/header-logo-navigation.php @@ -0,0 +1,16 @@ + __( 'Logo and Navigation Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+ + + +
+ ', +); diff --git a/inc/patterns/header-stacked.php b/inc/patterns/header-stacked.php new file mode 100644 index 00000000..55619ac8 --- /dev/null +++ b/inc/patterns/header-stacked.php @@ -0,0 +1,26 @@ + __( 'Logo and Navigation Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+ + + + + + + + + + + + + +
+ ', +); diff --git a/inc/patterns/header-text-only-all-caps-with-tagline.php b/inc/patterns/header-text-only-all-caps-with-tagline.php new file mode 100644 index 00000000..08435a59 --- /dev/null +++ b/inc/patterns/header-text-only-all-caps-with-tagline.php @@ -0,0 +1,20 @@ + __( 'Text-only Header with Tagline and all-caps Title', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+ +
+ + + + +
+ ', +); diff --git a/inc/patterns/header-text-only-with-stacked-tagline.php b/inc/patterns/header-text-only-with-stacked-tagline.php new file mode 100644 index 00000000..2ddd9fec --- /dev/null +++ b/inc/patterns/header-text-only-with-stacked-tagline.php @@ -0,0 +1,20 @@ + __( 'Text-only Header with stacked Tagline', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+ +
+ + + + +
+ ', +); diff --git a/inc/patterns/header-text-only-with-tagline.php b/inc/patterns/header-text-only-with-tagline.php new file mode 100644 index 00000000..0416885c --- /dev/null +++ b/inc/patterns/header-text-only-with-tagline.php @@ -0,0 +1,20 @@ + __( 'Text-only Header with Tagline', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+ +
+ + + + +
+ ', +); diff --git a/inc/patterns/header-text-only.php b/inc/patterns/header-text-only.php new file mode 100644 index 00000000..0e064f1a --- /dev/null +++ b/inc/patterns/header-text-only.php @@ -0,0 +1,16 @@ + __( 'Text-only Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+ + + +
+ ', +); diff --git a/inc/patterns/header-title-and-button.php b/inc/patterns/header-title-and-button.php new file mode 100644 index 00000000..0a679b4d --- /dev/null +++ b/inc/patterns/header-title-and-button.php @@ -0,0 +1,16 @@ + __( 'Title and Button Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+ + + +
+ ', +); diff --git a/inc/patterns/header-title-navigation-social.php b/inc/patterns/header-title-navigation-social.php new file mode 100644 index 00000000..4795f36c --- /dev/null +++ b/inc/patterns/header-title-navigation-social.php @@ -0,0 +1,22 @@ + __( 'Title, Navigation, and Social Links Header', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+ + + + + + + +
+ ', +); diff --git a/inc/patterns/header-with-tagline.php b/inc/patterns/header-with-tagline.php new file mode 100644 index 00000000..fc8f3a51 --- /dev/null +++ b/inc/patterns/header-with-tagline.php @@ -0,0 +1,24 @@ + __( 'Header with Tagline', 'twentytwentytwo' ), + 'categories' => array( 'twentytwentytwo-headers' ), + 'blockTypes' => array( 'core/template-part/header' ), + 'content' => ' +
+
+ + +
+ +
+
+ + + + +
+ ', +);