bp_register_template_stack( string $location_callback = '', int $priority = 10 )

Register a new template stack location.

Description

This allows for templates to live in places beyond just the parent/child relationship, to allow for custom template locations. Used in conjunction with bp_locate_template(), this allows for easy template overrides.

Parameters

$location_callback

(string) (Optional) Callback function that returns the stack location.

Default value: ''

$priority

(int) (Optional) The priority parameter as passed to add_filter(). Default: 10.

Default value: 10

Return

(bool) See add_filter().

Source

File: bp-core/bp-core-template-loader.php

function bp_register_template_stack( $location_callback = '', $priority = 10 ) {

	// Bail if no location, or function/method is not callable.
	if ( empty( $location_callback ) || ! is_callable( $location_callback ) ) {
		return false;
	}

	// Add location callback to template stack.
	return add_filter( 'bp_template_stack', $location_callback, (int) $priority );
}

Changelog

Changelog
Version Description
BuddyPress 1.7.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.