wp_create_template
Create an Elementor THEME BUILDER template as a DRAFT: header, footer, single-post, single-page, archive, search-results, error-404, loop-item, product, product-archive (Pro required for these), or page/section (free). Build content with sections (same native CONTAINER spec + style object as wp_create_page). Optionally pass conditions (Elementor include/exclude grammar, e.g. ["include/general"] = entire site, "include/singular/front_page", "include/singular/page/123", "include/archive", "exclude/singular/page/12") and publish=true to go live immediately — otherwise review the draft first, then wp_set_template_conditions. Templates render SITE-WIDE per their conditions — always screenshot-review before publishing. Requires writes enabled + Xyle Connector v0.3.0+.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Template title | |
| publish | No | Publish immediately after setting conditions (default false — draft-first) | |
| site_id | Yes | The WordPress site ID | |
| sections | No | JSON array — native Elementor CONTAINER spec (same shape as wp_create_page, incl. per-widget `style`) | |
| conditions | No | JSON array of condition strings, e.g. ["include/general"] | |
| page_settings | No | JSON object of Elementor page settings. For a POPUP (template_type=popup, Pro), this is the open/close triggers, e.g. {"triggers":{"page_load":"yes","page_load_delay":2}} for on-load, or {"triggers":{"exit_intent":"yes"}}. To open a popup from a BUTTON instead, build a button widget with `open_popup: <popup_id>` (no page_settings needed). Elementor renders the popup JS natively — no custom script. | |
| template_type | Yes | header | footer | single-post | single-page | single | archive | search-results | error-404 | loop-item | product | product-archive | popup | page | section | |
| elementor_data | No | Raw _elementor_data JSON (advanced alternative to sections) |