CC Child Pages Hooks Reference

Overview

Last updated: 19th November 2025 for CC Child Pages version 2.0

This document lists the public hooks (filters and actions) exposed by the CC Child Pages plugin, along with parameters and return values. It also includes the single JavaScript filter available in the block editor UI.

Note: Hook names are stable, but templates and data structures may evolve. When appropriate, prefer adding to rather than replacing arrays.

PHP Filters

ccchildpages_defaults: Filter the default shortcode attributes.

  • Params: (array defaults)
  • Return: array of defaults
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_attributes: Filter the normalized shortcode attributes after shortcode_atts.

  • Params: (array atts)
  • Return: array of attributes
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_outer_template: Filter the outer HTML template wrapper.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{class}}{{skin}}{{ccchildpages}}
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_inner_template: Filter the per‑item (card) inner template.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{page_class}}{{title_tag}}{{meta}}{{thumbnail}}{{excerpt}}{{more}}
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_title_template: Filter the title tag template.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{title}}{{title_class}}
  • Where: includes/ccchildpages.php
  • Since: 1.41

ccchildpages_meta_template: Filter the meta container template.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{meta}}
  • Where: includes/ccchildpages.php
  • Since: 1.35

ccchildpages_excerpt_template: Filter the excerpt wrapper template.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{page_excerpt}}
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_more_template: Filter the “Read more” markup.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{link}}{{link_target}}{{more}}
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_list_pages_args: Filter arguments passed to wp_list_pages when list="true".

  • Params: (array args, array atts)
  • Return: array args
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_query_args: Filter arguments passed to WP_Query for fetching children/specified pages.

  • Params: (array args, array atts)
  • Return: array args
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_child_list_title: Filter the subpages title template used for nested child lists.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{subpage_title}}
  • Where: includes/ccchildpages.php
  • Since: 1.35

ccchildpages_child_list_template: Filter the subpages list container template.

  • Params: (string template, array atts)
  • Return: string template.
    Tokens: {{child_list_title}}{{child_list}}
  • Where: includes/ccchildpages.php
  • Since: 1.35

ccchildpages_before_shortcode: Prepend content before the final shortcode HTML.

  • Params: (string prepend, array atts)
  • Return: string to insert before
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_after_shortcode: Append content after the final shortcode HTML.

  • Params: (string append, array atts)
  • Return: string to insert after
  • Where: includes/ccchildpages.php
  • Since: 1.29

ccchildpages_options: Filter the default plugin options on activation.

  • Params: (array options)
  • Return: array options
  • Where: includes/ccchildpages.php
  • Since: 1.31

ccchildpages_menu_page_title: Filter the settings page title (admin).

  • Params: (string page_title)
  • Return: string
  • Where: includes/ccchildpages.php

ccchildpages_menu_title: Filter the settings menu title (admin).

  • Params: (string menu_title)
  • Return: string
  • Where: includes/ccchildpages.php
  • Since: 1.36

ccchildpages_menu_function: Replace the callback used to render the settings page (admin).

  • Params: (callable callback)
  • Return: callable
  • Where: includes/ccchildpages.php
  • Since: 1.36

cc_child_pages_editor_skins: Filter the map of available skins exposed to the block editor and frontend logic.

  • Params: (array skins) e.g. { 'simple' => 'Simple', ... }
  • Return: array skins
  • Where: includes/ccchildpages.php
  • Since: 2.0.0

Widget Filters

These affect the classic widget output (ccchildpages_widget).

ccchildpages_widget_pages_args: Filter args passed to wp_list_pages for the widget tree.

  • Params: (array args, array $widget_args, array $instance)
  • Return: array args
  • Where: includes/ccchildpages_widget.php
  • Since: 1.29

ccchildpages_widget_start_ul: Filter the opening list tag.

  • Params: (string open, array $widget_args, array $instance)
  • Return: string
  • Where: includes/ccchildpages_widget.php
  • Since: 1.29

ccchildpages_widget_end_ul: Filter the closing list tag.

  • Params: (string close, array $widget_args, array $instance)
  • Return: string
  • Where: includes/ccchildpages_widget.php
  • Since: 1.29

ccchildpages_widget_output: Filter the combined widget HTML (UL with items).

  • Params: (string html, array $widget_args, array $instance)
  • Return: string
  • Where: includes/ccchildpages_widget.php
  • Since: 1.29

ccchildpages_before_widget: Filter the wrapper printed before the widget ($args['before_widget']).

  • Params: (string before, array $widget_args, array $instance)
  • Return: string
  • Where: includes/ccchildpages_widget.php
  • Since: 1.30

ccchildpages_widget_before_title: Filter the wrapper printed before the title ($args['before_title']).

  • Params: (string before_title, array $widget_args, array $instance)
  • Return: string
  • Where: includes/ccchildpages_widget.php
  • Since: 1.30

ccchildpages_widget_after_title: Filter the wrapper printed after the title ($args['after_title']).

  • Params: (string after_title, array $widget_args, array $instance)
  • Return: string
  • Where: includes/ccchildpages_widget.php
  • Since: 1.30

ccchildpages_after_widget: Filter the wrapper printed after the widget ($args['after_widget']).

  • Params: (string after, array $widget_args, array $instance)
  • Return: string
  • Where: includes/ccchildpages_widget.php
  • Since: 1.30

PHP Actions

ccchildpages_options_form: Action within the plugin settings form to add custom fields.

  • Params: (array options)
  • Where: includes/ccchildpages.php
  • Since: 1.31

JavaScript Filters (Block Editor)

ccChildPages.skins: Filter the skin options shown in the block’s Inspector Controls.

  • Signature: applyFilters('ccChildPages.skins', options)
  • Params: options — array of objects { value: string, label: string }
  • Return: same shape array (duplicates by value are de‑duplicated later)
  • Since: 2.0.0

Examples

Add a custom skin label via PHP (also makes it available to the editor):

add_filter('cc_child_pages_editor_skins', function ($skins) {
    $skins['mybrand'] = __('My Brand', 'my-textdomain');
    return $skins;
});

Inject a banner before/after every shortcode instance:

add_filter('ccchildpages_before_shortcode', function ($prepend, $atts) {
    return '<div class="my-banner">'.esc_html__('Featured', 'my-td').'</div>' . $prepend;
}, 10, 2);

add_filter('ccchildpages_after_shortcode', function ($append, $atts) {
    return $append . '<div class="my-after">'.esc_html__('Thanks for reading', 'my-td').'</div>';
}, 10, 2);

Customize the query to include only pages with a specific meta key:

add_filter('ccchildpages_query_args', function ($args, $atts) {
    $args['meta_query'] = array(
        array(
            'key' => 'featured',
            'value' => '1',
        ),
    );
    return $args;
}, 10, 2);

Alter the widget UL to use a nav list:

add_filter('ccchildpages_widget_start_ul', function ($open) { return '<ul class="nav nav-pills">'; }, 10, 3);
add_filter('ccchildpages_widget_end_ul', function ($close) { return '</ul>'; }, 10, 3);

Extend the skin list in the editor via JS:

wp.hooks.addFilter('ccChildPages.skins', 'my-plugin/skins', (options) => {
  return [ ...options, { value: 'mybrand', label: 'My Brand' } ];
});