bbp_register_template_stack( $location_callback = '', int $priority = 10 )

This is really cool. This function registers a new template stack location, using WordPress’s built in filters API.

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 bbp_locate_template(), this allows for easy template overrides.

Parameters

$location

(Required) Callback function that returns the

$priority

(Optional)

Default value: 10

Source

File: bp-forums/core/template-functions.php

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

	// Bail if no location, or function does not exist
	if ( empty( $location_callback ) || ! function_exists( $location_callback ) )
		return false;

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

Changelog

Changelog
Version Description
bbPress (r4323) 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.