Skip to content

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 ​

HookTypeWhat it does
arts/theme/page_body/print_attributesactionRuns inside the <body> tag. Echo extra attributes.
arts/theme/page_header/beforeactionRuns before the header.
arts/theme/page_header/afteractionRuns after the header. Velum opens the page wrapper here at priorities 20 and 30.
arts/theme/page_footer/beforeactionRuns before the footer. Velum closes the page wrapper here at priorities 20 and 30.
arts/theme/page_footer/afteractionRuns after the footer, before wp_footer().
arts/theme/page_header/bar/endactionAdds 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/attributesfilterThe attributes of <main id="page-wrapper">, as an array.
arts/theme/page_wrapper/outer/tagfilterIts tag, main by default.
arts/theme/page_wrapper/inner/attributesfilterThe attributes of the div inside it.
arts/theme/page_wrapper/inner/tagfilterIts tag, div by default.
arts/theme/comments/area/attributesfilterThe attributes of the comments section.
arts/theme/comments/list_title/attributesfilterThe attributes of the comments title.
arts/theme/comments/list/attributesfilterThe attributes of the comment list.
arts/theme/location_documentfilterReceives 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 ​

HookTypeWhat it does
velum_elementor/reveal_entrancesfiltertrue 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_prefixfilterThe 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 ​

HookTypeWhat it does
arts_live_search/post_typesfilterThe post types the search looks through, as an array of names.
arts_live_search/query_argsfilterThe WP_Query arguments of a search. Receives them and the search request.
arts_live_search/thumbnail_sizefilterThe image size of a search result, medium by default.
arts_live_search/before_queryactionRuns before each search, with the search request.
arts_live_search/after_queryactionRuns after each search.
arts/post_password/form/after_fieldactionRuns 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.