parts.php
Manages editable copies of theme parts, including separate drafts, revisions, and publication of shared header or footer content.
Responsibility#
Manages editable copies of theme parts, including separate drafts, revisions, and publication of shared header or footer content.
This is an implementation reference for the released 0.9.13 module. Internal PHP helpers are not a compatibility promise for third-party callers. Prefer the documented REST, Abilities, theme, and filter contracts.
Related modules#
blocks, element-js, render, rest, theme.
Literal option and cache keys#
page_on_front. These are direct literal keys found in this module; dynamically constructed keys and metadata constants are covered by the storage reference.
WordPress hooks#
| Operation | Hook |
|---|---|
add_action |
init |
add_action |
admin_bar_menu |
add_action and add_filter subscribe to a hook; do_action and apply_filters expose a hook. A subscription is not itself a new extension API. Dynamic hook names are not included in this literal inventory.
Function and method reference#
cantata_edit_part_post#
function cantata_edit_part_post( string $slug ): ?WP_Post
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Source location: includes/parts.php:25.
cantata_edit_part_draft_key#
function cantata_edit_part_draft_key( int $user_id = 0 ): string
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Source location: includes/parts.php:40.
cantata_edit_part_other_drafts#
function cantata_edit_part_other_drafts( string $slug ): array
Who else has an unpublished draft of this part: [ display name, ... ], known names first.
Implementation connections: cantata_edit_part_post.
Source location: includes/parts.php:45.
cantata_edit_part_published#
function cantata_edit_part_published( string $slug ): string
The part as published (the saved copy, else the theme's file).
Implementation connections: cantata_edit_part_default, cantata_edit_part_post.
Source location: includes/parts.php:70.
cantata_edit_part_draft#
function cantata_edit_part_draft( string $slug ): string
The current user's own draft of a part, or ''.
Implementation connections: cantata_edit_part_draft_key, cantata_edit_part_post.
Source location: includes/parts.php:76.
cantata_edit_part_rev#
function cantata_edit_part_rev( string $slug ): string
A fingerprint of the published part, to notice when someone else published it meanwhile.
Implementation connections: cantata_edit_part_published.
Source location: includes/parts.php:82.
cantata_edit_part_edit_url#
function cantata_edit_part_edit_url( string $slug ): string
Where the header or footer is edited: the front page with only that part editable, or '' when there is none.
Source location: includes/parts.php:92.
cantata_edit_part_source#
function cantata_edit_part_source( string $slug ): string
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Implementation connections: cantata_edit_is_editing, cantata_edit_part_draft, cantata_edit_part_published.
Source location: includes/parts.php:117.
cantata_edit_part#
function cantata_edit_part( string $slug ): void
Print a part. While editing it is wrapped in an element the editor can find; display:contents keeps the wrapper out of the layout, so a sticky header or a body > footer rule behaves as it does live.
Implementation connections: cantata_edit_is_editing, cantata_edit_part_post, cantata_edit_part_source, cantata_edit_render.
Source location: includes/parts.php:134.
cantata_edit_validate_part#
function cantata_edit_validate_part( string $slug, string $html )
Save a part as a draft or publish it. Creates the editable copy the first time.
Implementation connections: cantata_edit_live_allowed.
Source location: includes/parts.php:145.
cantata_edit_save_part#
function cantata_edit_save_part( string $slug, string $html, bool $publish )
Internal implementation helper in this module. Its name and signature identify the operation and accepted PHP values; it is not a standalone authenticated endpoint.
Implementation connections: cantata_edit_atomic, cantata_edit_drop_meta, cantata_edit_element_js_sign_html, cantata_edit_part_default, cantata_edit_part_draft_key, cantata_edit_part_post, cantata_edit_put_meta, cantata_edit_storage_error, cantata_edit_validate_part.
Source location: includes/parts.php:160.