Bundled Themes: Introduce block patterns for Twenty Twenty.

Props melchoyce, Anlino, kjellr, ryelle.
Fixes #51098.


git-svn-id: https://develop.svn.wordpress.org/trunk@49347 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2020-10-27 20:59:30 +00:00
parent 6501d4c93c
commit 93cc559468
2 changed files with 206 additions and 0 deletions

View File

@ -178,6 +178,9 @@ require get_template_directory() . '/classes/class-twentytwenty-non-latin-langua
// Custom CSS.
require get_template_directory() . '/inc/custom-css.php';
// Block Patterns.
require get_template_directory() . '/inc/block-patterns.php';
/**
* Register and Enqueue Styles.
*/

View File

@ -0,0 +1,203 @@
<?php
/**
* Block Patterns
*
* @link https://developer.wordpress.org/reference/functions/register_block_pattern/
* @link https://developer.wordpress.org/reference/functions/register_block_pattern_category/
*
* @package WordPress
* @subpackage Twenty_Twenty
* @since Twenty Twenty 1.5
*/
/**
* Register Block Pattern Category.
*/
if ( function_exists( 'register_block_pattern_category' ) ) {
register_block_pattern_category(
'twentytwenty',
array( 'label' => esc_html__( 'Twenty Twenty', 'twentytwenty' ) )
);
}
/**
* Register Block Patterns.
*/
if ( function_exists( 'register_block_pattern' ) ) {
// Call to Action.
register_block_pattern(
'twentytwenty/call-to-action',
array(
'title' => esc_html__( 'Call to Action', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:group {"align":"wide","style":{"color":{"background":"#ffffff"}}} -->',
'<div class="wp-block-group alignwide has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:group -->',
'<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'Support the Museum and Get Exclusive Offers', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"align":"center"} -->',
'<p class="has-text-align-center">' . esc_html__( 'Members get access to exclusive exhibits and sales. Our memberships cost $99.99 and are billed annually.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:button {"align":"center","className":"is-style-outline"} -->',
'<div class="wp-block-button aligncenter is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Become a Member', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div></div>',
'<!-- /wp:group --></div></div>',
'<!-- /wp:group -->',
)
)
)
);
// Double Call to Action.
register_block_pattern(
'twentytwenty/double-call-to-action',
array(
'title' => esc_html__( 'Double Call to Action', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:columns {"align":"wide"} -->',
'<div class="wp-block-columns alignwide"><!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:group {"style":{"color":{"background":"#ffffff"}}} -->',
'<div class="wp-block-group has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'The Museum', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"align":"center"} -->',
'<p class="has-text-align-center">' . esc_html__( 'Award-winning exhibitions featuring internationally-renowned artists.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:buttons {"align":"center"} -->',
'<div class="wp-block-buttons aligncenter"><!-- wp:button {"className":"is-style-outline"} -->',
'<div class="wp-block-button is-style-outline"><a class="wp-block-button__link">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:buttons --></div></div>',
'<!-- /wp:group --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:group {"style":{"color":{"background":"#ffffff"}}} -->',
'<div class="wp-block-group has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'The Store', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"align":"center"} -->',
'<p class="has-text-align-center">' . esc_html__( 'An awe-inspiring collection of books, prints, and gifts from our exhibitions.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:buttons {"align":"center"} -->',
'<div class="wp-block-buttons aligncenter"><!-- wp:button {"className":"is-style-outline"} -->',
'<div class="wp-block-button is-style-outline"><a class="wp-block-button__link">' . esc_html__( 'Shop Now', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:buttons --></div></div>',
'<!-- /wp:group --></div>',
'<!-- /wp:column --></div>',
'<!-- /wp:columns -->',
)
)
)
);
// Event Details.
register_block_pattern(
'twentytwenty/event-details',
array(
'title' => esc_html__( 'Event Details', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:group {"align":"wide","backgroundColor":"primary"} -->',
'<div class="wp-block-group alignwide has-primary-background-color has-background"><div class="wp-block-group__inner-container"><!-- wp:columns -->',
'<div class="wp-block-columns"><!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
'<p class="has-text-align-center has-background-color has-text-color has-large-font-size">' . wp_kses_post( __( '<em>Dates</em><br>Aug 1 — Dec 1', 'twentytwentyone' ) ) . '</p>',
'<!-- /wp:paragraph --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
'<p class="has-text-align-center has-background-color has-text-color has-large-font-size">' . wp_kses_post( __( '<em>Location</em><br>Exhibit Hall B', 'twentytwentyone' ) ) . '</p>',
'<!-- /wp:paragraph --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
'<p class="has-text-align-center has-background-color has-text-color has-large-font-size">' . wp_kses_post( __( '<em>Price</em><br>Included', 'twentytwentyone' ) ) . '</p>',
'<!-- /wp:paragraph --></div>',
'<!-- /wp:column --></div>',
'<!-- /wp:columns --></div></div>',
'<!-- /wp:group -->',
)
)
)
);
// Featured Content.
register_block_pattern(
'twentytwenty/featured-content',
array(
'title' => esc_html__( 'Featured Content', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:columns {"align":"wide"} -->',
'<div class="wp-block-columns alignwide"><!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:image {"sizeSlug":"full"} -->',
'<figure class="wp-block-image size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/2020-three-quarters-1.png" alt="' . esc_attr__( 'Abstract Rectangles', 'twentytwenty' ) . '"/></figure>',
'<!-- /wp:image -->',
'<!-- wp:heading -->',
'<h2>' . esc_html__( 'Works and Days', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"fontSize":"larger"} -->',
'<p class="has-larger-font-size">' . esc_html__( 'August 1 — December 1', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:button {"align":"left","className":"is-style-outline"} -->',
'<div class="wp-block-button alignleft is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:image {sizeSlug":"full"} -->',
'<figure class="wp-block-image size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/2020-three-quarters-2.png" alt="' . esc_attr__( 'Abstract Rectangles', 'twentytwenty' ) . '"/></figure>',
'<!-- /wp:image -->',
'<!-- wp:heading -->',
'<h2>' . esc_html__( 'The Life I Deserve', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"fontSize":"larger"} -->',
'<p class="has-larger-font-size">' . esc_html__( 'August 1 — December 1', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:button {"align":"left","className":"is-style-outline"} -->',
'<div class="wp-block-button alignleft is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:column --></div>',
'<!-- /wp:columns -->',
)
)
)
);
// Introduction.
register_block_pattern(
'twentytwenty/introduction',
array(
'title' => esc_html__( 'Introduction', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'The Premier Destination for Modern Art in Sweden', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"dropCap":true} -->',
'<p class="has-drop-cap">' . esc_html__( 'With seven floors of striking architecture, UMoMA shows exhibitions of international contemporary art, sometimes along with art historical retrospectives. Existential, political, and philosophical issues are intrinsic to our program. As visitor, you are invited to guided tours artist talks, lectures, film screenings, and other events with free admission.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
)
)
)
);
}