wp-block-patterns
БесплатноБез исполняемых скриптовНе проверенCreate, register, and organize WordPress block patterns. File-based patterns, PHP registration, categories, and synced patterns.
от wpgaurav★ 24 звезды на GitHubОб этом скилле
WordPress Block Patterns
When to Use
Use this skill when:
- Creating reusable block layouts for themes
- Building a pattern library
- Registering patterns programmatically
- Working with synced (reusable) patterns
- Setting up pattern categories
Pattern Basics
Block patterns are pre-designed block layouts users can insert with one click. Two types:
- Unsynced patterns - Independent copies inserted each time
- Synced patterns - Global patterns that update everywhere when changed
File-Based Patterns (Recommended)
Since WordPress 6.0, create patterns by placing PHP files in your theme's /patterns/ directory.
Directory Structure
your-theme/
├── patterns/
│ ├── hero-section.php
│ ├── pricing-table.php
│ ├── testimonial-grid.php
│ ├── call-to-action.php
│ └── team-members.php
├── style.css
└── theme.json
Pattern File Template
<?php
/**
* Title: Hero Section
* Slug: theme-name/hero-section
* Categories: featured, banner
* Keywords: hero, banner, header, intro
* Description: A full-width hero section with heading, text, and buttons.
* Viewport Width: 1400
* Block Types: core/post-content
* Post Types: page, post
* Inserter: true
*/
?>
<!-- wp:cover {"url":"<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/hero-bg.jpg","dimRatio":60,"overlayColor":"black","minHeight":600,"align":"full"} -->
<div class="wp-block-cover alignfull" style="min-height:600px">
<span aria-hidden="true" class="wp-block-cover__background has-black-background-color has-background-dim-60 has-background-dim"></span>
<div class="wp-block-cover__inner-container">
<!-- wp:heading {"textAlign":"center","level":1} -->
<h1 class="wp-block-heading has-text-align-center">Welcome to Our Site</h1>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">Your compelling tagline goes here.</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">Get Started</a></div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
</div>
<!-- /wp:cover -->
Required Headers
| Header | Required | Description |
|---|---|---|
Title |
Yes | Display name in pattern inserter |
Slug |
Yes | Unique identifier (namespace/pattern-name) |
Optional Headers
| Header | Description | Example |
|---|---|---|
Categories |
Comma-separated categories | featured, hero, banner |
Keywords |
Search terms | hero, header, intro, welcome |
Description |
Longer description for accessibility | Full-width hero with... |
Viewport Width |
Preview width in inserter | 1400 |
Block Types |
Show in block transforms | core/post-content, core/group |
Post Types |
Limit to specific post types | page, post, product |
Inserter |
Show in inserter | true or false |
Template Types |
For template patterns | front-page, single |
PHP Registration Method
For plugins or dynamic patterns:
function my_register_patterns() {
register_block_pattern(
'my-plugin/hero-section',
array(
'title' => __( 'Hero Section', 'my-plugin' ),
'description' => __( 'A full-width hero with heading and CTA', 'my-plugin' ),
'categories' => array( 'featured', 'banner' ),
'keywords' => array( 'hero', 'header', 'intro' ),
'content' => '<!-- wp:cover {"dimRatio":50} -->...',
'blockTypes' => array( 'core/post-content' ),
'postTypes' => array( 'page' ),
'inserter' => true,
)
);
}
add_action( 'init', 'my_register_patterns' );
Loading Content from File
function my_register_patterns() {
$patterns = array(
'hero-section',
'pricing-table',
'testimonials',
);
foreach ( $patterns as $pattern ) {
$file = plugin_dir_path( __FILE__ ) . "patterns/{$pattern}.html";
if ( file_exists( $file ) ) {
register_block_pattern(
"my-plugin/{$pattern}",
array(
'title' => ucwords( str_replace( '-', ' ', $pattern ) ),
'categories' => array( 'my-plugin-patterns' ),
'content' => file_get_contents( $file ),
)
);
}
}
}
add_action( 'init', 'my_register_patterns' );
Pattern Categories
Register Custom Category
function my_register_pattern_categories() {
register_block_pattern_category(
'my-theme-sections',
array(
'label' => __( 'Theme Sections', 'my-theme' ),
'description' => __( 'Pre-designed sections for building pages', 'my-theme' ),
)
);
Установить wp-block-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл wp-block-patterns?
Create, register, and organize WordPress block patterns. File-based patterns, PHP registration, categories, and synced patterns.
Как установить скилл wp-block-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл wp-block-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic