PHP hooks and filters
Velum's hooks work like any WordPress hook: add your callback with add_action() or add_filter() in the child theme's functions.php. Each table lists the hooks of one part of Velum.
Theme
| Hook | Type | What it does |
|---|---|---|
arts/theme/page_body/print_attributes | action | Runs inside the <body> tag. Echo extra attributes. |
arts/theme/page_header/before | action | Runs before the header. |
arts/theme/page_header/after | action | Runs after the header. Velum opens the page wrapper here at priorities 20 and 30. |
arts/theme/page_footer/before | action | Runs before the footer. Velum closes the page wrapper here at priorities 20 and 30. |
arts/theme/page_footer/after | action | Runs after the footer, before wp_footer(). |
arts/theme/page_header/bar/end | action | Adds items to the end of the theme's built-in header, the one shown when no Elementor header is set. |
arts/theme/page_wrapper/outer/attributes | filter | The attributes of <main id="page-wrapper">, as an array. |
arts/theme/page_wrapper/outer/tag | filter | Its tag, main by default. |
arts/theme/page_wrapper/inner/attributes | filter | The attributes of the div inside it. |
arts/theme/page_wrapper/inner/tag | filter | Its tag, div by default. |
arts/theme/comments/area/attributes | filter | The attributes of the comments section. |
arts/theme/comments/list_title/attributes | filter | The attributes of the comments title. |
arts/theme/comments/list/attributes | filter | The attributes of the comment list. |
arts/theme/location_document | filter | Receives 0 and the location, header or footer. Return the ID of an Elementor template to print it as that location; it then replaces any other header or footer. |
The page wrapper is what page transitions swap. Where your markup lands depends on the priority you add it at:
html
<body>
<!-- the header -->
<!-- arts/theme/page_header/after, priority below 20 -->
<main id="page-wrapper" class="page-wrapper">
<div id="page-wrapper__content" class="page-wrapper__content">
<!-- arts/theme/page_header/after, priority above 30 -->
<!-- the page content -->
</div>
</main>
<!-- the footer -->
</body>Markup outside the wrapper stays on screen from one page to the next. Markup inside it belongs to the page and is replaced on every page change:
php
add_action( 'arts/theme/page_header/after', 'velum_child_print_banner', 10 );
function velum_child_print_banner() {
echo '<div class="site-banner">Shown on every page, never replaced</div>';
}
add_action( 'arts/theme/page_header/after', 'velum_child_print_page_note', 40 );
function velum_child_print_page_note() {
echo '<div class="page-note">Replaced together with the page</div>';
}When you filter the wrapper's attributes, add to the array and keep the id: the skip link and the page transitions rely on it. The tag filters run twice, once for the opening tag and once for the closing one, so return the same value both times.
php
add_filter( 'arts/theme/page_wrapper/outer/attributes', 'velum_child_page_wrapper_attributes' );
function velum_child_page_wrapper_attributes( $attributes ) {
$attributes['class'][] = 'my-page-wrapper';
return $attributes;
}Velum Elementor
| Hook | Type | What it does |
|---|---|---|
velum_elementor/reveal_entrances | filter | true by default. Return false and no element hides to reveal itself on scroll: the widgets' entrance animations and Elementor's Motion Effects entrances are off and everything shows at once. |
velum_elementor/term_prefix | filter | The text shown before each category or tag name in a widget, such as the # before tags. Receives the prefix, the field name and where its terms come from, such as taxonomy.post_tag for tags. |
To show tags without the #:
php
add_filter( 'velum_elementor/term_prefix', 'velum_child_term_prefix', 10, 3 );
function velum_child_term_prefix( $prefix, $field, $source ) {
if ( 'taxonomy.post_tag' === $source ) {
return '';
}
return $prefix;
}Search and password-protected posts
| Hook | Type | What it does |
|---|---|---|
arts_live_search/post_types | filter | The post types the search looks through, as an array of names. |
arts_live_search/query_args | filter | The WP_Query arguments of a search. Receives them and the search request. |
arts_live_search/thumbnail_size | filter | The image size of a search result, medium by default. |
arts_live_search/before_query | action | Runs before each search, with the search request. |
arts_live_search/after_query | action | Runs after each search. |
arts/post_password/form/after_field | action | Runs in the password form of a protected post, below the field. Receives the post ID. Print a block element, such as a div. |
php
add_filter( 'arts_live_search/post_types', 'velum_child_search_post_types' );
function velum_child_search_post_types( $post_types ) {
return array_values( array_diff( $post_types, array( 'page' ) ) );
}WooCommerce and WordPress hooks
Velum's shop widgets print WooCommerce's own templates, so WooCommerce's actions and filters keep working inside them, such as woocommerce_single_product_summary or woocommerce_before_shop_loop_item. The same goes for WordPress's menu, content and comment filters.
Next: Overriding templates.