convert-to-wp-theme
Convert a complete HTML/CSS/JavaScript project into a production-ready WordPress block theme (Full Site Editing).
Migrate existing WordPress content (Classic Editor, ACF, widgets, CPTs, shortcodes, page builders) into a block theme.
> /plugin marketplace add siddik-web/wp-block-theme-converter > /plugin install wp-block-theme-converter@siddik-web
How it fires
How this command gets triggered: by you, by Claude, or both.
/wp-migrateContext preview
What this command does when you run it.
Migrate existing WordPress content (Classic Editor, ACF, widgets, CPTs, shortcodes, page builders) into a block theme.
description: Migrate existing WordPress content (Classic Editor, ACF, widgets, CPTs, shortcodes, page builders) into a block theme.
**Purpose:** Generate the code, queries, and patterns needed to migrate existing WordPress content — classic editor posts, widget areas, ACF fields, shortcodes, or Custom Post Types — into the new block theme structure.
Trigger this command when:
This command is NOT for converting static HTML → WordPress (use `/convert-to-wp-theme` for that).
If the user mentions or you detect a page builder in scope, load `references/page-builder-migration.md` **before** Step 2. That reference contains per-builder playbooks with element→block mapping tables, WP-CLI extraction commands, and worked examples. Use the builder-specific workflow from that reference instead of the generic approach below for content extraction.
| Builder detected | Action | |-----------------|--------| | Elementor / Elementor Pro | Load page-builder-migration.md §1 | | Divi / Divi Builder | Load page-builder-migration.md §2 | | WPBakery / Visual Composer | Load page-builder-migration.md §3 | | Beaver Builder / BB Themer | Load page-builder-migration.md §4 | | Classic Gutenberg (no builder) | Load page-builder-migration.md §5 | | None / unknown | Continue with generic workflow below |
Ask (or infer from context):
| Question | Why it matters | |----------|---------------| | WordPress version currently running | Determines available migration tools | | Active page builder (Elementor, Divi, Beaver Builder, WPBakery, none) | Different conversion strategies per builder — see page-builder-migration.md | | Using Classic Editor or already using Gutenberg? | Classic content needs block conversion | | Custom Post Types (CPTs) — list their slugs | Need Query Loop templates or custom blocks | | Custom fields plugin (ACF, CMB2, Meta Box, Pods, none) | Determines Block Bindings approach | | Widget areas — list names and their content | Become template parts in block theme | | Shortcodes in use — list them | Need block or pattern equivalents | | How many posts/pages need migration (estimate) | Batch vs programmatic migration | | WooCommerce products? | WooCommerce-specific template migration |
Before writing any code, output a table mapping old content to its new block equivalent:
MIGRATION MAP ============== | Old Element | New Block Equivalent | Migration Method | |------------------------------------|----------------------------------------|----------------------| | Classic Editor post | Block editor post (auto-convert) | Content Transform API | | [hero] shortcode | my-theme/hero pattern | Shortcode replacement | | sidebar widget area | parts/sidebar.html template part | Template part | | footer widget area | parts/footer.html (already exists) | Template part | | ACF field: `hero_headline` | Block Binding → post meta | Bindings API | | CPT: `project` | Query Loop + custom template part | Template hierarchy | | Elementor template: Landing Page | FSE page template | Manual rebuild |
Show this map and get user confirmation before generating code.
Handle each category in order:
---
WordPress's built-in parser handles most of this automatically. Provide:
**1. PHP script to audit content (run via WP-CLI or a one-off plugin):**
<?php
// Identify posts still using classic editor content (no block markup).
// Run via: wp eval-file audit-classic-content.php
$posts = get_posts( array(
'post_type' => 'any',
'posts_per_page' => -1,
'post_status' => array( 'publish', 'draft', 'private' ),
) );
$classic_posts = array();
foreach ( $posts as $post ) {
if ( ! has_blocks( $post->post_content ) ) {
$classic_posts[] = array(
'ID' => $post->ID,
'post_type' => $post->post_type,
'post_title' => $post->post_title,
'edit_url' => get_edit_post_link( $post->ID ),
);
}
}
echo 'Classic Editor posts: ' . count( $classic_posts ) . PHP_EOL;
foreach ( $classic_posts as $p ) {
echo sprintf( '[%d] %s (%s) — %s', $p['ID'], $p['post_title'], $p['post_type'], $p['edit_url'] ) . PHP_EOL;
}**2. Bulk conversion note:**
WordPress automatically wraps Classic Editor paragraphs in `<!-- wp:paragraph -->` blocks when displayed in the block editor. For most text content this is sufficient. For complex layouts (tables, floated images, shortcodes), manual editing is needed.
---
For each shortcode, provide:
1. The block or pattern equivalent 2. A PHP filter to render the block equivalent instead of the shortcode (for programmatic posts) 3. A WP-CLI command to find all posts using the shortcode
**Finding all shortcode usages:**
wp post list --post_type=post,page --format=ids | xargs -I{} wp post get {} --field=post_content | grep -c '\[{{shortcode_tag}}'**Replacing shortcodes in existing content (WP-CLI batch):**
wp search-replace '[{{shortcode_tA Claude Code plugin (and standalone skill) for converting any HTML/CSS/JavaScript project into a production-ready WordPress Block Theme (Full Site Editing). Author: Md Siddiqur Rahman License: MIT
Repo: siddik-web/wp-block-theme-converter
Convert a complete HTML/CSS/JavaScript project into a production-ready WordPress block theme (Full Site Editing).
Generate an empty, valid WordPress block theme scaffold from scratch — no source HTML required.
Scaffold a custom WordPress block (block.json, edit.js, save.js or render.php, styles) ready to register inside a block theme.
Convert an existing classic WordPress theme (PHP templates, functions.php) into a Full Site Editing block theme.
Diagnose and fix WordPress block-theme failures — block validation errors, theme.json issues, missing patterns, DB template overrides, and PHP warnings.
Convert a single HTML section or snippet into a registered WordPress block pattern PHP file.