Filters and Hooks

Singular Alerts exposes WordPress filters for customizing fonts, headlines, block availability, content processing, and branding.

Add filter callbacks in a custom plugin or your theme’s functions.php.

Fonts

alerts_dlx_load_fonts

Control whether Singular Alerts loads the bundled Lato Google Font.

add_filter( 'alerts_dlx_load_fonts', '__return_false' );Code language: JavaScript (javascript)

alerts_dlx_default_font_family

Set the font family used when custom fonts are disabled.

add_filter(
    'alerts_dlx_default_font_family',
    function () {
        return 'Raleway, sans-serif';
    }
);Code language: JavaScript (javascript)

See Custom Fonts for a complete example.

Headline and Title

alerts_dlx_headline_style

Filter the HTML element used for alert titles (h1–h6 or div).

add_filter(
    'alerts_dlx_headline_style',
    function () {
        return 'h3';
    }
);Code language: JavaScript (javascript)

Security note: The return value is validated server-side. Only h1, h2, h3, h4, h5, h6, and div are allowed in output. Any other value falls back to h2.

alerts_dlx_headline_custom_classes

Filter space-separated CSS classes applied to alert title elements (in addition to alerts-dlx-title).

add_filter(
    'alerts_dlx_headline_custom_classes',
    function ( $classes ) {
        return $classes . ' no-toc';
    }
);Code language: PHP (php)

alerts_dlx_headline_force_size

Filter whether alert title font size is forced over theme styles.

add_filter( 'alerts_dlx_headline_force_size', '__return_true' );Code language: JavaScript (javascript)

Block Themes

alerts_dlx_enabled_block_styles

Filter which alert block themes are available. Default includes bootstrap, chakra, material, and shoelace.

add_filter(
    'alerts_dlx_enabled_block_styles',
    function ( $styles ) {
        return array( 'chakra' );
    }
);Code language: PHP (php)

Content and Colors

alerts_dlx_the_content

Filter alert description content before output (shortcode inner content and alert_description). Runs through the same pipeline as the_content filters.

add_filter( 'alerts_dlx_the_content', 'wpautop' );Code language: JavaScript (javascript)

alerts_dlx_color_palette

Filter the color palette available for custom alert colors in the block editor.

add_filter(
    'alerts_dlx_color_palette',
    function ( $palette ) {
        // Modify $palette array.
        return $palette;
    }
);Code language: PHP (php)

REST API

alerts_dlx_rest_post_types_to_search

Filter post types searched when picking button links in the block editor. Default: post, page.

add_filter(
    'alerts_dlx_rest_post_types_to_search',
    function ( $post_types ) {
        $post_types[] = 'product';
        return $post_types;
    }
);Code language: PHP (php)

Branding (Admin)

These filters customize plugin metadata shown in the WordPress admin:

FilterDefault
alerts_dlx_plugin_nameAlertsDLX
alerts_dlx_plugin_descriptionPlugin description string
alerts_dlx_plugin_urihttps://dlxplugins.com/plugins/alertsdlx
alerts_dlx_plugin_authorMediaRon LLC
alerts_dlx_plugin_author_urihttps://mediaron.com
alerts_dlx_plugin_support_urihttps://dlxplugins.com/support/
alerts_dlx_plugin_docs_urihttps://alertsdlx.dlxplugins.com/
alerts_dlx_plugin_menu_titleAlertsDLX

Example:

add_filter(
    'alerts_dlx_plugin_name',
    function () {
        return 'My Custom Alerts';
    }
);Code language: JavaScript (javascript)

Was this article helpful?

Leave a Reply