Save single page
fabrement-save-single-pageCreate or change a single-page bundle — render.php + optional style.css, view.js, hooks.php — that fills a template's CONTENT area with a layout a block cannot express. Send files whole, or change an existing bundle with edits (fragment replacements per file) + expectedHash from get-single-page. summary is required on every save; description and logic on create and whenever php/js/hooks change. Returns the path a contentSource rule points at.
Rules: get-skill-doc {id:"single-page-contract"} — read it before the first call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"summary": "<summary>"
},
"name": "fabrement-save-single-page"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js | No | view.js contents (enqueued in the footer). Omit to keep; delete with remove. | |
| css | No | style.css contents (enqueued when present). Omit to keep; delete with remove. | |
| php | No | The complete render.php contents. Required when creating; omit to keep. | |
| name | Yes | Bundle slug (lowercase, hyphens; the folder name). | |
| edits | No | Fragment replacements per file of the EXISTING bundle, instead of re-sending it. A file is sent whole OR edited, not both. | |
| hooks | No | hooks.php — PHP run on `init` before render, on every FRONT-END request (never admin, REST, cron or WP-CLI): the only place to touch the MAIN query (pre_get_posts); every callback guards is_admin(), is_main_query() and the exact view. Omit to keep; delete with remove. | |
| logic | No | How it WORKS: the query it runs, the URL params it reads, the meta keys, what an empty result renders. This is what the next session reads instead of your PHP. | |
| title | No | Human name shown in the pickers (default: the slug). | |
| remove | No | Files to delete: css, js, hooks. An EMPTY value ("") never deletes — it counts as not sent. render.php cannot be removed (delete the bundle instead). | |
| summary | Yes | REQUIRED on every save: what you did THIS save. Kept as the bundle history (last 10) — the next session reads it for context. | |
| contexts | No | Views this body was written for: "singular:post", "archive:project", "blog-home". A note for the next session and for list-*; nothing enforces it — the platform only checks singular-vs-archive when a rule is wired. | |
| requires | No | What it needs to work: {postTypes:[…], meta:[…]}. A note for whoever copies the bundle to another site; nothing checks it at runtime. | |
| description | No | What the page SHOWS — how the next session recognises it in a listing. | |
| expectedHash | No | `hash` from the get tool. If any file changed since, nothing is saved. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | No | Of the saved bundle — expectedHash for the next save. | |
| name | Yes | ||
| path | Yes | ||
| hasJs | No | ||
| logic | No | ||
| title | No | ||
| hasCss | No | ||
| contexts | No | ||
| hasHooks | No | ||
| requires | No | ||
| hasListing | No | ||
| description | Yes |