Skip to content

Actions and Filters—Theme Configuration

Jo Dickson edited this page Sep 29, 2021 · 3 revisions

Navigation

Action functions

Filter functions


ucfwp_init

Hooks into: after_setup_theme

Priority: 10 (default)

Initialization functions to be fired early when WordPress loads the theme.

add_theme_support() calls, image size registration, menu location registration, and sidebar registration take place in this hook.


ucfwp_define_customizer_sections

Hooks into: customize_register

Priority: 10 (default)

Defines sections used in the WordPress Customizer.


ucfwp_define_customizer_fields

Hooks into: customize_register

Priority: 10 (default)

Defines settings and controls used in the WordPress Customizer.


ucfwp_kill_unused_templates

Hooks into: template_redirect

Priority: 10 (default)

Disables attachment pages, author pages, daily archive pages, search, and feeds; redirects requests for these pages to the homepage.

If your site requires any of the templates listed above, you should un-register this action in a child theme, like so:

// Your child theme's functions.php
function reenable_templates() {
    remove_action( 'template_redirect', 'ucfwp_kill_unused_templates' );
}
add_action( 'after_setup_theme', 'reenable_templates' );

You can then optionally define your own custom behavior for the template_redirect hook in your child theme if you'd like to still redirect some templates, or add your own custom template redirection behavior.


ucfwp_kill_unused_widgets

Hooks into: widgets_init

Priority: 10 (default)

Disable widgets that aren't supported by this theme.


ucfwp_kill_comments

Hooks into: init

Priority: 10 (default)

Provides an opinionated set of overrides for this theme that disables comments, trackbacks, and pingbacks sitewide, and hides references to comments in the WordPress admin to reduce clutter.

If your site requires comments, you should un-register this action in a child theme, like so:

// Your child theme's functions.php
function reenable_comments() {
    remove_action( 'init', 'ucfwp_kill_comments' );
}
add_action( 'after_setup_theme', 'reenable_comments' );

Since the UCF WordPress Theme doesn't provide a comment template, your child theme will need to provide one in order to display comments. You'll also need to override the singular.php template, or create a single.php template that displays the comment template.

For more information, see the WordPress Theme Handbook article on comment templates.


ucfwp_custom_mimes

Hooks into: upload_mimes

Priority: 10 (default)

Override's WordPress's default list of allowed file types in the media library to allow extra types when using this theme (svg, json).


ucfwp_kses_allowed_html

Hooks into: wp_kses_allowed_html

Priority: 10

Overrides allowed HTML tags and their allowed attributes for HTML added to post content. In particular, this hook enables tags and attributes necessary for Athena component usage, and also re-enables other blacklisted elements for convenience, such as <iframe>s.


ucfwp_modify_attachment_links

Hooks into: attachment_link

Priority: 20

Modifies attachment links to point directly to individual files instead of single attachment views.

Takes effect only when the ucfwp_kill_unused_templates hook is registered, and/or if the ucfwp_enable_attachment_link_rewrites hook has been passed a custom value.


ucfwp_excerpt_more

Hooks into: excerpt_more

Priority: 10 (default)

Modifies the string printed at the end of post excerpts.

Clone this wiki locally