Add code-owned output to a POM template
POM does not expose a general API for registering arbitrary new merge-tag names. Use an existing context tag for structured content, or register a shortcode when the output must remain owned by a plugin or child theme.
Feed and single template output passes through WordPress shortcodes after POM replaces its supported merge tags. Archive templates provide the final pom_archive_template_html filter.
Use a shortcode in feed or single content
Register a prefixed shortcode and return escaped or intentionally allowed markup:
add_shortcode(
'acme_resource_badge',
static function ( array $attributes ): string {
$attributes = shortcode_atts(
array( 'post_id' => 0 ),
$attributes,
'acme_resource_badge'
);
$post_id = absint( $attributes['post_id'] );
return $post_id
? '<span class="resource-badge">' . esc_html__( 'Resource', 'acme' ) . '</span>'
: '';
}
);
Insert the shortcode only in a saved feed or single template whose runtime supplies the needed values. Do not accept callbacks, templates, capabilities, or raw HTML from shortcode attributes.
For example, the template can pass the current content ID after POM resolves it:
[acme_resource_badge post_id="{{post_id}}"]
Filter an archive shell
add_filter(
'pom_archive_template_html',
static function ( string $html, string $post_type ): string {
if ( 'resource' !== $post_type ) {
return $html;
}
return $html . '<p class="resource-note">' .
esc_html__( 'Browse all resources.', 'acme' ) .
'</p>';
},
10,
2
);
The filter receives already replaced archive HTML and the archive post type. It does not add a merge tag to feed or single contexts.
Verify
Test the normal archive, taxonomy archive, empty results, progressive loading where used, translations, and the integration disabled. Request conditional assets explicitly if the added output needs them.