bbp_register_template_stack( string $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 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 Parameters

$location_callback

(Optional) Callback function that returns the

Default value: ''

$priority

(Optional)

Default value: 10


Top ↑

Source Source

File: includes/core/template-functions.php

function bbp_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( 'bbp_template_stack', $location_callback, (int) $priority );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.