loop-templates.php
Registers reusable single-item loop templates, validates their root structure, and resolves published layouts before per-item dynamic rendering.
Responsibility#
Registers reusable single-item loop templates, validates their root structure, and resolves published layouts before per-item dynamic rendering.
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#
kindly-menu, linked-components, render, rest, templates, theme-templates, theme.
Module constants#
const CANTATA_EDIT_LOOP = 'kindly_loop';
These values describe this release. Defined configuration constants and generated identifiers can have different ownership; do not edit stored values directly without following the corresponding workflow.
WordPress hooks#
| Operation | Hook |
|---|---|
add_action |
init |
add_filter |
cantata_edit_content_owner_check |
add_action |
template_redirect |
add_filter |
oembed_request_post_id |
add_filter |
template_include |
add_action |
rest_api_init |
add_action |
wp_enqueue_scripts |
add_action |
cantata_edit_menu_after_templates |
add_filter |
cantata_edit_menu_action |
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_loop_tpl_starter#
function cantata_edit_loop_tpl_starter(): string
A new loop template's card: a picture, the title as a link, the first words and the date, all from each post.
Source location: includes/loop-templates.php:35.
cantata_edit_loop_tpl_clean#
function cantata_edit_loop_tpl_clean( string $html )
A card as a template keeps it: the build contract and sanitizer, one element, and none of the page's loop marks (which template it is, or its alternate-item setting): those belong to the loop on the page.
Implementation connections: cantata_edit_linked_inner, cantata_edit_linked_parse, cantata_edit_template_clean.
Source location: includes/loop-templates.php:46.
cantata_edit_loop_tpl_html#
function cantata_edit_loop_tpl_html( int $id ): ?string
A published loop template's card, or null (missing, trashed, unpublished, not a loop template).
Source location: includes/loop-templates.php:66.
cantata_edit_loop_tpls_render#
function cantata_edit_loop_tpls_render( string $html ): string
Each loop item that uses a template shows the template's published card, keeping its own place in the loop (an alternate item stays one, every so many posts). Runs before dynamic data, so each copy is then filled from its post; while editing too, so the page shows the card as it is now.
Implementation connections: cantata_edit_linked_inner, cantata_edit_linked_parse, cantata_edit_loop_tpl_html.
Source location: includes/loop-templates.php:76.
cantata_edit_loop_tpl_usage#
function cantata_edit_loop_tpl_usage( int $id ): array
Where a loop template is used: [ count, where: [ titles ] ] over pages, posts, theme templates and drafts.
Implementation connections: cantata_edit_url.
Source location: includes/loop-templates.php:104.
cantata_edit_loop_tpl_out#
function cantata_edit_loop_tpl_out( WP_Post $p ): array
A loop template in lists: name, state, where to edit it.
Implementation connections: cantata_edit_asset_ver, cantata_edit_can_themes, cantata_edit_is_editing, cantata_edit_loop_tpl_clean, cantata_edit_loop_tpl_starter, cantata_edit_loop_tpl_usage, cantata_edit_menu_rest, cantata_edit_url.
Source location: includes/loop-templates.php:114.
cantata_edit_menu_loops#
function cantata_edit_menu_loops(): void
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_can_themes, cantata_edit_loop_tpl_out, cantata_edit_loop_tpl_usage, cantata_edit_menu_add, cantata_edit_menu_art, cantata_edit_menu_card_state, cantata_edit_menu_empty, cantata_edit_menu_head, cantata_edit_menu_list, cantata_edit_menu_name, cantata_edit_menu_row_tools, cantata_edit_menu_section, cantata_edit_menu_trash, cantata_edit_menu_trashed, cantata_edit_training_button.
Source location: includes/loop-templates.php:228.