EMCP Themer
New in v3.1.0. EMCP Themer is a builder-agnostic WordPress theme builder: design Header / Footer / Single / Archive / Search / 404 layouts with any page builder (Gutenberg, Elementor, …), assign display conditions, and the plugin injects them on the front end. It’s free and on by default, with 8 MCP tools so an AI agent can create and target templates end to end.
Loops (Loop Item / Loop Grid) are intentionally out of scope.
How it works
Section titled “How it works”- One CPT, any builder. Templates are a single custom post type (
emcp_theme_template), editable by whatever builder you use: Gutenberg, Elementor, or another. Each template is typed (header/footer/single/archive/search/404) and carries its display conditions. - Its own dashboard menu. Themer gets a top-level EMCP Themer menu in wp-admin (not a tab inside EMCP Tools). The menu only exists while the module is active. Disabling the module is a true kill switch for the CPT, front-end rendering, tools, and menu.
- Slot-based resolution. Every request fills up to three slots: header / body / footer. The body slot’s type is derived from the main query (singular → single, archive → archive, plus search and 404). A pure resolver picks one winner per slot by matched-condition specificity → priority → newest.
- Conditions are Include / Exclude rules evaluated against a rebuilt-on-save, autoloaded condition index, so there are zero extra front-end database queries.
- Hybrid render engine. A body template (single/archive/page/search/404) keeps your theme’s header and footer and swaps only the content area, exactly like Elementor Pro’s Single templates. If you also build both a Themer header and footer, Themer renders a complete standalone document instead (no theme chrome). A single standalone header or footer is injected at the active theme’s hook via per-theme adapters, Astra, GeneratePress, Kadence, OceanWP, Blocksy, Neve, Hello, with a template-tag (
emcp_themer_location('header'|'footer')) and an optional force-render fallback for unsupported themes.
Honest limitation: dynamic single/archive templates are most powerful with Elementor’s dynamic tags; Gutenberg shines for header/footer/404/search.
The condition builder
Section titled “The condition builder”The template edit screen has an Elementor-style step-wise condition builder: Relation → Group → Sub-type → Object, plus an “Add condition” repeater. It’s type-aware: a Single template offers Singular targets, an Archive template offers Archives, Header/Footer can target anything, and Search/404 need no conditions.
Free vs Pro
Section titled “Free vs Pro”| Free | Pro | |
|---|---|---|
| Render engine + all template types | ✓ | ✓ |
| Templates per type | 1 | Unlimited |
| Scope selectors | Entire site · all singular · front page · one post type · all archives · one post-type archive · one taxonomy archive | + per-post, per-term, author, author-archive, date |
| Rules | Include | Include and Exclude |
| Priority ordering | ✗ | ✓ |
| All 8 MCP tools | ✓ | ✓ |
The whole engine and all 8 tools are free; Pro adds unlimited templates per type, granular targeting, Exclude rules, and priority.
Dynamic content elements
Section titled “Dynamic content elements”Classic themes don’t ship the dynamic blocks/widgets you need to build templates, so Themer adds its own: as both Gutenberg blocks and Elementor (free) widgets, under an EMCP Themer category in each builder. They resolve against the current request, so a Single template’s “Post Title” shows the viewed post, an Archive template’s “Archive Posts” shows that archive’s posts, and so on.
| Element | What it outputs |
|---|---|
| Post/Page Title | The queried post’s title (tag + optional link) |
| Archive Title | The archive’s title (category / tag / author / date / post-type) |
| Breadcrumbs | A trail: uses Yoast / Rank Math / SEOPress if present, else built-in |
| Post Meta | Date, author, categories, tags, comments (pick which) |
| Site Logo | The custom logo (linked), with a text fallback |
| Site Title | The site name (linked) + optional tagline |
| Menu | Any WordPress nav menu |
| Description | Post excerpt on singular, archive description on archives |
| Post Content | The queried post’s full content |
| Archive Posts | The archive loop: grid or list, columns, pagination |
Gutenberg blocks use native block supports (color, typography, spacing, border) so the editor’s own controls style them, with a live server-side preview. Elementor widgets add a Style tab (alignment, color, typography). Because they’re regular blocks, the Gutenberg block tools (add-block, insert-pattern) can drop them into templates over MCP.
MCP tools
Section titled “MCP tools”All 8 register when the Themer module is active. Build a template’s content with the Gutenberg or Elementor tools against the returned template_id.
emcp-tools/create-theme-template
Section titled “emcp-tools/create-theme-template”Create a theme template of a given type.
Input: type (header/footer/single/archive/search/404), title, optional conditions.
Returns: { template_id, edit_url, type }.
emcp-tools/list-theme-templates
Section titled “emcp-tools/list-theme-templates”List theme templates, optionally filtered by type.
Returns: array of { template_id, title, type, conditions }. Read-only.
emcp-tools/get-theme-template
Section titled “emcp-tools/get-theme-template”Full detail for one template: type, conditions, detected builder, built content status.
Input: template_id. Read-only.
emcp-tools/update-theme-template
Section titled “emcp-tools/update-theme-template”Update a template’s title, type, or conditions.
Input: template_id plus any of the fields.
emcp-tools/set-template-conditions
Section titled “emcp-tools/set-template-conditions”Set a template’s display conditions (Include/Exclude selectors, priority). Granular selectors, Exclude rules, and priority require Pro. They’re rejected on free with a clear message.
Input: template_id, conditions.
emcp-tools/delete-theme-template
Section titled “emcp-tools/delete-theme-template”Delete a theme template.
Input: template_id. Destructive.
emcp-tools/resolve-template
Section titled “emcp-tools/resolve-template”Verify which templates fill each slot (header/body/footer) for a given post or request context: the resolver’s decision, exposed for debugging your conditions.
Input: post_id or a context descriptor. Read-only.
emcp-tools/list-condition-targets
Section titled “emcp-tools/list-condition-targets”Discovery: list the selectors and objects (post types, taxonomies, …) you can target, so an agent can build valid conditions.
Returns: the available condition targets. Read-only.
PHP Templates (advanced)
Section titled “PHP Templates (advanced)”For layouts that neither Gutenberg nor Elementor free can express (a bespoke query loop, custom markup, or integration with another plugin’s template tags), Themer can hand a region’s render off to a custom PHP template. A connected AI agent authors the PHP into a validated sandbox; you then select it on a template, and it takes over that region’s render. The Themer template still owns where it applies (its type + display conditions); the PHP owns what markup is produced.
The feature is free but off by default. Turn it on under EMCP Tools → Tools → “Themer PHP Templates (advanced)”. Enabling it reveals a PHP Templates screen under the EMCP Themer menu (review the code + validation report of anything an agent authored) and a “Render with PHP template” selector on each template’s edit screen.
How it’s kept safe
Section titled “How it’s kept safe”- You are the execution gate. An AI can only create drafts. There is no “attach” tool. A draft has no executable file on disk and never runs. It only compiles and executes once you select it on a template in the metabox. Detaching it removes the compiled file again.
- Strict validation. Every template is scanned before it can be stored or compiled. Code execution (
eval/exec/backticks), file loading (include/require), network calls, and file writes are rejected outright, the same guardrail as the PHP Snippets sandbox. Emit markup withecho/heredoc; a closing?>tag is not allowed. - Tamper-proof + self-healing. Compiled templates are hash-verified on every render and run inside output buffering with fatal recovery, so a broken template falls back to your builder content instead of white-screening the page.
- Capability-gated. Authoring requires
manage_options+unfiltered_html.
Render behaviour
Section titled “Render behaviour”A PHP template is region-only. It outputs just its region’s markup and slots into the same engine as builder content. A single/archive template renders inside your theme’s header/footer; a header/footer template replaces the theme’s chrome via the theme adapter. If the PHP produces nothing (or errors), Themer transparently falls back to the template’s builder content.
MCP tools
Section titled “MCP tools”All five require the feature to be enabled and ship disabled-by-default (opt in per-tool on the Tools tab). There is intentionally no attach tool. Selection stays in your hands.
| Tool | Purpose |
|---|---|
emcp-tools/create-theme-php-template | Author a validated draft PHP template (type: header/footer/single/archive/any). Never runs until you attach it. |
emcp-tools/list-theme-php-templates | List drafts (id, title, type, compiled state, last error). Read-only. |
emcp-tools/get-theme-php-template | Return one template’s code + validation report. Read-only. |
emcp-tools/update-theme-php-template | Update a template’s code/title/type; re-validates (and recompiles if attached). |
emcp-tools/delete-theme-php-template | Delete a template and its sandbox file. Destructive. |