How to register patterns with Poet

Trying to register default pattern in the Poet config:

    'block_pattern_category' => [
        'all' => [
            'label' => 'All Patterns',
        ],
    ],

    'block_pattern' => [
        'sage/hero' => [
            'title' => 'Page Hero',
            'description' => 'Draw attention to the main focus of the page, and highlight key CTAs',
            'content' => '<!-- wp:paragraph --><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ratione nulla culpa repudiandae nisi nostrum et, labore earum repellendus porro, mollitia voluptas quam? Modi sint tempore deleniti nesciunt ab, perferendis et.</p><!-- /wp:paragraph -->',
            'categories' => ['all'],
        ],
    ],

But the patterns tab doesn’t appear in the blocks column. Am I missing something?

Captura de pantalla 2023-05-01 a las 8.10.38

Did you comment out the line remove_theme_support('core-block-patterns'); in setup.php?

1 Like

poet/BlockPatternModule.php at 3bc3a1dfa033e06ffdd84111b2ffa719a0eab2cf · Log1x/poet · GitHub you need to make a view for the pattern. I didn’t implement Block Pattern’s but it looks like it was an oversight and it shouldn’t be returning before checking for the existence of content as well.

Feel free to do a PR or open an issue.

2 Likes