Make WordPress Core

Ticket #51098: 51098.2.diff

File 51098.2.diff, 10.8 KB (added by ryelle, 4 years ago)
  • src/wp-content/themes/twentytwenty/functions.php

    diff --git a/src/wp-content/themes/twentytwenty/functions.php b/src/wp-content/themes/twentytwenty/functions.php
    index b350091349..292e2a4cff 100644
    a b require get_template_directory() . '/classes/class-twentytwenty-non-latin-langua 
    178178// Custom CSS.
    179179require get_template_directory() . '/inc/custom-css.php';
    180180
     181// Block Patterns.
     182require get_template_directory() . '/inc/block-patterns.php';
     183
    181184/**
    182185 * Register and Enqueue Styles.
    183186 */
  • new file src/wp-content/themes/twentytwenty/inc/block-patterns.php

    diff --git a/src/wp-content/themes/twentytwenty/inc/block-patterns.php b/src/wp-content/themes/twentytwenty/inc/block-patterns.php
    new file mode 100644
    index 0000000000..4fc3ca1c00
    - +  
     1<?php
     2/**
     3 * Block Patterns
     4 *
     5 * @link https://developer.wordpress.org/reference/functions/register_block_pattern/
     6 * @link https://developer.wordpress.org/reference/functions/register_block_pattern_category/
     7 *
     8 * @package WordPress
     9 * @subpackage Twenty_Twenty
     10 * @since Twenty Twenty 1.5
     11 */
     12
     13/**
     14 * Register Block Pattern Category.
     15 */
     16if ( function_exists( 'register_block_pattern_category' ) ) {
     17
     18        register_block_pattern_category(
     19                'twentytwenty',
     20                array( 'label' => esc_html__( 'Twenty Twenty', 'twentytwenty' ) )
     21        );
     22}
     23
     24/**
     25 * Register Block Patterns.
     26 */
     27if ( function_exists( 'register_block_pattern' ) ) {
     28
     29        // Call to Action.
     30        register_block_pattern(
     31                'twentytwenty/call-to-action',
     32                array(
     33                        'title'         => esc_html__( 'Call to Action', 'twentytwenty' ),
     34                        'categories'    => array( 'twentytwenty' ),
     35                        'viewportWidth' => 1400,
     36                        'content'       => implode(
     37                                '',
     38                                array(
     39                                        '<!-- wp:group {"align":"wide","style":{"color":{"background":"#ffffff"}}} -->',
     40                                        '<div class="wp-block-group alignwide has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:group -->',
     41                                        '<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
     42                                        '<h2 class="has-text-align-center">' . esc_html__( 'Become a Member and Get Exclusive Offers!', 'twentytwenty' ) . '</h2>',
     43                                        '<!-- /wp:heading -->',
     44                                        '<!-- wp:paragraph {"align":"center"} -->',
     45                                        '<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>',
     46                                        '<!-- /wp:paragraph -->',
     47                                        '<!-- wp:button {"align":"center","className":"is-style-outline"} -->',
     48                                        '<div class="wp-block-button aligncenter is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Join the Club', 'twentytwenty' ) . '</a></div>',
     49                                        '<!-- /wp:button --></div></div>',
     50                                        '<!-- /wp:group --></div></div>',
     51                                        '<!-- /wp:group -->',
     52                                )
     53                        )
     54                )
     55        );
     56
     57        // Double Call to Action.
     58        register_block_pattern(
     59                'twentytwenty/double-call-to-action',
     60                array(
     61                        'title'         => esc_html__( 'Double Call to Action', 'twentytwenty' ),
     62                        'categories'    => array( 'twentytwenty' ),
     63                        'viewportWidth' => 1400,
     64                        'content'       =>  implode(
     65                                '',
     66                                array(
     67                                        '<!-- wp:columns {"align":"wide"} -->',
     68                                        '<div class="wp-block-columns alignwide"><!-- wp:column -->',
     69                                        '<div class="wp-block-column"><!-- wp:group {"style":{"color":{"background":"#ffffff"}}} -->',
     70                                        '<div class="wp-block-group has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
     71                                        '<h2 class="has-text-align-center">' . esc_html__( 'The Museum', 'twentytwenty' ) . '</h2>',
     72                                        '<!-- /wp:heading -->',
     73                                        '<!-- wp:paragraph {"align":"center"} -->',
     74                                        '<p class="has-text-align-center">' . esc_html__( 'Award-winning exhibitions featuring internationally-renowned artists from all over the world.', 'twentytwenty' ) . '</p>',
     75                                        '<!-- /wp:paragraph -->',
     76                                        '<!-- wp:buttons {"align":"center"} -->',
     77                                        '<div class="wp-block-buttons aligncenter"><!-- wp:button {"className":"is-style-outline"} -->',
     78                                        '<div class="wp-block-button is-style-outline"><a class="wp-block-button__link">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
     79                                        '<!-- /wp:button --></div>',
     80                                        '<!-- /wp:buttons --></div></div>',
     81                                        '<!-- /wp:group --></div>',
     82                                        '<!-- /wp:column -->',
     83                                        '<!-- wp:column -->',
     84                                        '<div class="wp-block-column"><!-- wp:group {"style":{"color":{"background":"#ffffff"}}} -->',
     85                                        '<div class="wp-block-group has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
     86                                        '<h2 class="has-text-align-center">' . esc_html__( 'The Store', 'twentytwenty' ) . '</h2>',
     87                                        '<!-- /wp:heading -->',
     88                                        '<!-- wp:paragraph {"align":"center"} -->',
     89                                        '<p class="has-text-align-center">' . esc_html__( 'An awe-inspiring collection of books, prints, and miscellaneous items from our exhibitions.', 'twentytwenty' ) . '</p>',
     90                                        '<!-- /wp:paragraph -->',
     91                                        '<!-- wp:buttons {"align":"center"} -->',
     92                                        '<div class="wp-block-buttons aligncenter"><!-- wp:button {"className":"is-style-outline"} -->',
     93                                        '<div class="wp-block-button is-style-outline"><a class="wp-block-button__link">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
     94                                        '<!-- /wp:button --></div>',
     95                                        '<!-- /wp:buttons --></div></div>',
     96                                        '<!-- /wp:group --></div>',
     97                                        '<!-- /wp:column --></div>',
     98                                        '<!-- /wp:columns -->',
     99                                )
     100                        )
     101                )
     102        );
     103
     104        // Event Details.
     105        register_block_pattern(
     106                'twentytwenty/event-details',
     107                array(
     108                        'title'         => esc_html__( 'Event Details', 'twentytwenty' ),
     109                        'categories'    => array( 'twentytwenty' ),
     110                        'viewportWidth' => 1400,
     111                        'content'       =>  implode(
     112                                '',
     113                                array(
     114                                        '<!-- wp:group {"align":"wide","backgroundColor":"primary"} -->',
     115                                        '<div class="wp-block-group alignwide has-primary-background-color has-background"><div class="wp-block-group__inner-container"><!-- wp:columns -->',
     116                                        '<div class="wp-block-columns"><!-- wp:column -->',
     117                                        '<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
     118                                        '<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>',
     119                                        '<!-- /wp:paragraph --></div>',
     120                                        '<!-- /wp:column -->',
     121                                        '<!-- wp:column -->',
     122                                        '<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
     123                                        '<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>',
     124                                        '<!-- /wp:paragraph --></div>',
     125                                        '<!-- /wp:column -->',
     126                                        '<!-- wp:column -->',
     127                                        '<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
     128                                        '<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>',
     129                                        '<!-- /wp:paragraph --></div>',
     130                                        '<!-- /wp:column --></div>',
     131                                        '<!-- /wp:columns --></div></div>',
     132                                        '<!-- /wp:group -->',
     133                                )
     134                        )
     135                )
     136        );
     137
     138        // Featured Content.
     139        register_block_pattern(
     140                'twentytwenty/featured-content',
     141                array(
     142                        'title'         => esc_html__( 'Featured Content', 'twentytwenty' ),
     143                        'categories'    => array( 'twentytwenty' ),
     144                        'viewportWidth' => 1400,
     145                        'content'       =>  implode(
     146                                '',
     147                                array(
     148                                        '<!-- wp:columns {"align":"wide"} -->',
     149                                        '<div class="wp-block-columns alignwide"><!-- wp:column -->',
     150                                        '<div class="wp-block-column"><!-- wp:image {"sizeSlug":"full"} -->',
     151                                        '<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>',
     152                                        '<!-- /wp:image -->',
     153                                        '<!-- wp:heading -->',
     154                                        '<h2>' . esc_html__( 'Works and Days', 'twentytwenty' ) . '</h2>',
     155                                        '<!-- /wp:heading -->',
     156                                        '<!-- wp:paragraph {"fontSize":"larger"} -->',
     157                                        '<p class="has-larger-font-size">' . esc_html__( 'August 1 — December 1', 'twentytwenty' ) . '</p>',
     158                                        '<!-- /wp:paragraph -->',
     159                                        '<!-- wp:button {"align":"left","className":"is-style-outline"} -->',
     160                                        '<div class="wp-block-button alignleft is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
     161                                        '<!-- /wp:button --></div>',
     162                                        '<!-- /wp:column -->',
     163                                        '<!-- wp:column -->',
     164                                        '<div class="wp-block-column"><!-- wp:image {sizeSlug":"full"} -->',
     165                                        '<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>',
     166                                        '<!-- /wp:image -->',
     167                                        '<!-- wp:heading -->',
     168                                        '<h2>' . esc_html__( 'The Life I Deserve', 'twentytwenty' ) . '</h2>',
     169                                        '<!-- /wp:heading -->',
     170                                        '<!-- wp:paragraph {"fontSize":"larger"} -->',
     171                                        '<p class="has-larger-font-size">' . esc_html__( 'August 1 — December 1', 'twentytwenty' ) . '</p>',
     172                                        '<!-- /wp:paragraph -->',
     173                                        '<!-- wp:button {"align":"left","className":"is-style-outline"} -->',
     174                                        '<div class="wp-block-button alignleft is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
     175                                        '<!-- /wp:button --></div>',
     176                                        '<!-- /wp:column --></div>',
     177                                        '<!-- /wp:columns -->',
     178                                )
     179                        )
     180                )
     181        );
     182
     183        // Introduction.
     184        register_block_pattern(
     185                'twentytwenty/introduction',
     186                array(
     187                        'title'         => esc_html__( 'Introduction', 'twentytwenty' ),
     188                        'categories'    => array( 'twentytwenty' ),
     189                        'viewportWidth' => 1400,
     190                        'content'       =>  implode(
     191                                '',
     192                                array(
     193                                        '<!-- wp:heading {"align":"center"} -->',
     194                                        '<h2 class="has-text-align-center">' . esc_html__( 'The premier destination for modern art in Sweden. Open 10 AM → 6 PM every day during winter.', 'twentytwenty' ) . '</h2>',
     195                                        '<!-- /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 programme. As a visitor you are invited to guided tours artist talks, lectures, film screenings and other events with free admission.', 'twentytwenty' ) . '</p>',
     196                                        '<!-- /wp:paragraph -->',
     197                                )
     198                        )
     199                )
     200        );
     201}