Skip to content

Hooks and Filters

Alex de Borba edited this page Jun 21, 2026 · 1 revision

Hooks and Filters

This page documents all WordPress action hooks and filters provided by the Aegis theme. These hooks allow developers and plugins to extend theme functionality without modifying core files.

Action Hooks

Template Hooks

These hooks fire at specific locations within templates:

Hook Location Parameters
aegis_before_header Before the header template part None
aegis_after_header After the header template part None
aegis_before_footer Before the footer template part None
aegis_after_footer After the footer template part None
aegis_before_content Before the main content area None
aegis_after_content After the main content area None

Single Post/Page Hooks

Hook Location Parameters
aegis_before_post_title Before the post title $post_id
aegis_after_post_title After the post title $post_id
aegis_before_post_content Before the post body $post_id
aegis_after_post_content After the post body $post_id
aegis_before_comments Before the comments section $post_id
aegis_after_comments After the comments section $post_id

Archive Hooks

Hook Location Parameters
aegis_before_archive_title Before the archive header None
aegis_after_archive_title After the archive header None
aegis_before_loop Before the post loop None
aegis_after_loop After the post loop None
aegis_between_posts Between loop iterations $post_id, $index

Asset Hooks

Hook Timing Parameters
aegis_before_enqueue_styles Before theme styles are enqueued None
aegis_after_enqueue_styles After theme styles are enqueued None
aegis_before_enqueue_scripts Before theme scripts are enqueued None
aegis_after_enqueue_scripts After theme scripts are enqueued None

Block Hooks

Hook Timing Parameters
aegis_before_register_blocks Before custom blocks are registered None
aegis_after_register_blocks After all custom blocks are registered None
aegis_before_register_patterns Before patterns are registered None
aegis_after_register_patterns After all patterns are registered None

WooCommerce Hooks

Available only when WooCommerce is active:

Hook Location Parameters
aegis_before_product_loop Before the product grid None
aegis_after_product_loop After the product grid None
aegis_before_cart_totals Before cart totals None
aegis_before_checkout_form Before checkout fields None
aegis_checkout_step_change When multi-step checkout advances $step_number

Filter Hooks

Asset Filters

Filter Description Parameters Return
aegis_enqueue_block_styles Filter the list of block styles to enqueue $styles (array) Array of style handles
aegis_enqueue_block_scripts Filter the list of block scripts to enqueue $scripts (array) Array of script handles
aegis_detected_blocks Filter the list of detected blocks on the page $blocks (array) Array of block names
aegis_font_families Filter the font families loaded $fonts (array) Array of font definitions

Template Filters

Filter Description Parameters Return
aegis_template_parts Filter available template parts $parts (array) Array of template part definitions
aegis_block_patterns Filter registered block patterns $patterns (array) Array of pattern definitions
aegis_style_variations Filter available style variations $variations (array) Array of variation paths

Feature Filters

Filter Description Parameters Return
aegis_analytics_providers Filter active analytics providers $providers (array) Array of provider configs
aegis_analytics_consent_required Whether analytics require consent $required (bool) Boolean
aegis_conditional_logic_conditions Filter available condition types $conditions (array) Array of condition definitions
aegis_dark_mode_enabled Whether dark mode is enabled $enabled (bool) Boolean
aegis_dark_mode_class The CSS class used for dark mode $class (string) CSS class name

Block Filters

Filter Description Parameters Return
aegis_block_categories Filter custom block categories $categories (array) Array of categories
aegis_countdown_defaults Default attributes for Countdown block $defaults (array) Array of attributes
aegis_slider_defaults Default attributes for Slider block $defaults (array) Array of attributes
aegis_related_posts_query Filter the Related Posts query args $args (array), $post_id WP_Query args array
aegis_video_facade_enabled Whether video facade is active $enabled (bool), $block Boolean

Integration Filters

Filter Description Parameters Return
aegis_woocommerce_support Whether WooCommerce integration loads $enabled (bool) Boolean
aegis_plugin_integrations Filter active plugin integrations $integrations (array) Array of integration slugs
aegis_theme_updater_config Filter the auto-updater configuration $config (array) Array of updater settings

Usage Examples

Adding Content via Action Hook

add_action( 'aegis_after_post_content', function( $post_id ) {
    if ( get_post_type( $post_id ) === 'post' ) {
        echo '<div class="author-box">Written by ' . esc_html( get_the_author() ) . '</div>';
    }
}, 10, 1 );

Filtering Detected Blocks

add_filter( 'aegis_detected_blocks', function( $blocks ) {
    // Always load countdown styles even if block is not in content
    $blocks[] = 'aegis/countdown';
    return $blocks;
} );

Modifying Related Posts Query

add_filter( 'aegis_related_posts_query', function( $args, $post_id ) {
    $args['posts_per_page'] = 6;
    $args['orderby'] = 'rand';
    return $args;
}, 10, 2 );

Disabling a Feature

// Disable dark mode site-wide
add_filter( 'aegis_dark_mode_enabled', '__return_false' );

// Disable WooCommerce integration
add_filter( 'aegis_woocommerce_support', '__return_false' );

Customizing the Updater

add_filter( 'aegis_theme_updater_config', function( $config ) {
    $config['check_interval'] = 24 * HOUR_IN_SECONDS;
    return $config;
} );

Hook Priority Reference

Priority Usage
1–9 Early execution (before defaults)
10 Default priority
11–20 After default execution
50+ Late execution
99+ Very late (cleanup, final modifications)

Related Pages

Clone this wiki locally