一键导入
wp-classic
Conventions for WordPress Bedrock projects with classic PHP theme (no Sage/Acorn/Blade). Always-active rules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Conventions for WordPress Bedrock projects with classic PHP theme (no Sage/Acorn/Blade). Always-active rules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | wp-classic |
| description | Conventions for WordPress Bedrock projects with classic PHP theme (no Sage/Acorn/Blade). Always-active rules. |
| user-invocable | false |
{{PREFIX}} if configured)package.json)register_post_type() / register_taxonomy() in inc/post-types.php{{THEME_DIR}}/
├── templates/ # Page templates (page-*.php, single-*.php, archive-*.php)
├── parts/ # Reusable template partials
├── inc/
│ ├── post-types.php # CPT and taxonomy registration
│ ├── acf-blocks.php # ACF blocks (if ACF active)
│ ├── helpers.php # Helper functions
│ └── enqueue.php # Scripts and styles enqueue
├── assets/
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript
│ ├── images/ # Images
│ └── fonts/ # Fonts
├── acf-json/ # Exported ACF field groups (if ACF active)
├── functions.php # Theme setup, hooks, filters, require inc/*
├── style.css # Main stylesheet (with theme header)
├── header.php # Global header
├── footer.php # Global footer
├── sidebar.php # Sidebar (if present)
├── index.php # Fallback template
├── front-page.php # Homepage
├── page.php # Generic pages
├── single.php # Single post
├── archive.php # Archive
├── search.php # Search results
└── 404.php # Error page
{{PREFIX}} (if configured)If the project uses a Tailwind CSS 4 prefix:
| Type | Format | Example |
|---|---|---|
| Tailwind utilities | {{PREFIX}}:{utility} | {{PREFIX}}:flex, {{PREFIX}}:p-4 |
| CSS components | {{PREFIX}}-{name} | .{{PREFIX}}-button, .{{PREFIX}}-card |
| Semantic utilities | {{PREFIX}}-{cat}-{var} | {{PREFIX}}-content-01 |
page-{slug}.php, single-{cpt}.php, etc.)get_template_part('parts/name', 'variant') — never hardcoded pathsinc/helpers.php| Type | Convention |
|---|---|
| Template files | kebab-case (page-about.php, single-bando.php) |
| Functions | snake_case with theme prefix (mytheme_setup(), mytheme_enqueue()) |
| PHP classes | PascalCase |
| Constants | UPPER_SNAKE_CASE |
get_template_part('parts/name', $args) (WP 5.5+)$args parameter:
get_template_part('parts/card', 'post', [
'title' => get_the_title(),
'excerpt' => get_the_excerpt(),
'thumbnail_id' => get_post_thumbnail_id(),
]);
$args:
$title = $args['title'] ?? '';
$excerpt = $args['excerpt'] ?? '';
Registered in inc/post-types.php with native WordPress functions.
Example:
function mytheme_register_post_types() {
register_post_type('bando', [
'labels' => [
'name' => __('Bandi', '{{TEXT_DOMAIN}}'),
'singular_name' => __('Bando', '{{TEXT_DOMAIN}}'),
],
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'supports' => ['title', 'editor', 'thumbnail', 'custom-fields'],
'menu_icon' => 'dashicons-media-document',
'rewrite' => ['slug' => 'bandi'],
]);
}
add_action('init', 'mytheme_register_post_types');
Registered with acf_register_block_type() in inc/acf-blocks.php:
function mytheme_register_acf_blocks() {
if (!function_exists('acf_register_block_type')) return;
acf_register_block_type([
'name' => 'hero',
'title' => __('Hero', '{{TEXT_DOMAIN}}'),
'description' => __('Hero block with image and text', '{{TEXT_DOMAIN}}'),
'render_template' => 'parts/blocks/hero.php',
'category' => 'theme',
'icon' => 'cover-image',
'keywords' => ['hero', 'banner'],
'supports' => ['align' => ['wide', 'full']],
]);
}
add_action('acf/init', 'mytheme_register_acf_blocks');
<?php
// parts/blocks/hero.php
$title = get_field('title');
$image = get_field('image');
$classes = 'block-hero';
if (!empty($block['className'])) $classes .= ' ' . $block['className'];
if (!empty($block['align'])) $classes .= ' align' . $block['align'];
?>
<section class="<?php echo esc_attr($classes); ?>">
<h2><?php echo esc_html($title); ?></h2>
<?php if ($image): ?>
<img src="<?php echo esc_url($image['url']); ?>"
alt="<?php echo esc_attr($image['alt']); ?>">
<?php endif; ?>
</section>
Created from the ACF Pro GUI. If configured, exported to acf-json/ for version control.
// In functions.php or inc/acf.php
function mytheme_acf_json_save_point($path) {
return get_stylesheet_directory() . '/acf-json';
}
add_filter('acf/settings/save_json', 'mytheme_acf_json_save_point');
// inc/enqueue.php
function mytheme_enqueue_assets() {
$theme_version = wp_get_theme()->get('Version');
wp_enqueue_style(
'{{TEXT_DOMAIN}}-style',
get_stylesheet_uri(),
[],
$theme_version
);
wp_enqueue_script(
'{{TEXT_DOMAIN}}-main',
get_theme_file_uri('assets/js/main.js'),
[],
$theme_version,
true
);
}
add_action('wp_enqueue_scripts', 'mytheme_enqueue_assets');
@include() or Blade syntax — this theme uses plain PHPbud.config.js or vite.config.js without verifying firstvar(--color-*)<a role="button"> or clickable <div> — use native elementsoutline on :focus without a visible alternativearia-hidden="true" focusable="false" on decorative SVGsalt=""functions.php — use inc/post-types.phpacf-json/echo without escaping — always esc_html(), esc_attr(), esc_url(), wp_kses_post()Audit and improve web accessibility following WCAG 2.1 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".
Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".
Optimize for search engine visibility and ranking. Use when asked to "improve SEO", "optimize for search", "fix meta tags", "add structured data", "sitemap optimization", or "search engine optimization".
WordPress operations with WP-CLI — search-replace, plugin/theme management, cron, cache, DB export/import, automation. Always-active rules when using wp commands.
WCAG 2.2 checklist for accessible markup. Always-active rules for every generated interface.
How to use Figma MCP and Variables2CSS to read designs from Figma and generate code consistent with tokens. Use when the designer shares a Figma link.