Save archive page
fabrement-save-archive-pageCreate or change an ARCHIVE bundle — render.php looping the MAIN query (+ optional style.css, view.js, hooks.php, listing.php) — that fills a template's CONTENT area on an archive view. Send files whole, or change an existing bundle with edits (fragment replacements per file) + expectedHash from get-archive-page. summary is required on every save; description and logic on create and whenever php/js/hooks change. Returns the path for a contentSource rule; then assign-template-archive. listing.php is the OTHER way into the same bundle: the rows alone, included by the archive-list block wherever it sits in the archive record's content, so the rows land between blocks arranged in the editor. render.php reaches that file with fabrement_listing().
Rules: get-skill-doc {id:"archive-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-archive-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 (loops the main query). Required when creating; omit to keep. | |
| name | Yes | Bundle slug (lowercase, hyphens; the folder name; unique across single AND archive bundles). | |
| 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, listing. An EMPTY value ("") never deletes — it counts as not sent. render.php cannot be removed (delete the bundle instead). | |
| listing | No | listing.php — the ROWS ALONE, a second way into this bundle. The archive-list block, placed in the archive record's content, includes this file at its position, so the rows sit between blocks arranged in the editor instead of render.php owning the whole content area. It prints the listing and nothing around it: no page furniture, no fabrement_archive_content() — those are already drawn around it. render.php reaches the same file with fabrement_listing(), so write the rows here once rather than in both. Omit to keep; delete with remove. | |
| 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 |