Twenty Twenty-One: A Deep Dive into the New Default WordPress Theme
If you choose to build your pattern in the Block Editor, you simply need to add necessary blocks to a post or page draft, then switch to the Code Editor and copy the corresponding code.
We can now register our pattern in the child theme’s functions.php file:
add_action( ‘init’, function(){
register_block_pattern_category(
‘custom-patterns’,
array( ‘label’ => esc_html__( ‘Custom patterns’, ‘twentytwentyone-child’ ) ) );
register_block_pattern(
‘twentytwentyone-child/custom-bio-pattern’,
array(
‘title’ => __( ‘Author Bio’, ‘twentytwentyone-child’ ),
‘description’ => _x( ‘A block with 2 columns that displays an avatar image, a heading and a paragraph.’, ‘Block pattern description’, ‘twentytwentyone-child’ ),