bbp_get_template_part( string $slug, string $name = null )

Adds Forums theme support to any active WordPress theme

Description

Parameters

$slug

(string) (Required)

$name

(string) (Optional) Default null

Default value: null

Source

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

function bbp_get_template_part( $slug, $name = null ) {

	// Execute code for this part
	do_action( 'get_template_part_' . $slug, $slug, $name );

	// Setup possible parts
	$templates = array();
	if ( isset( $name ) )
		$templates[] = $slug . '-' . $name . '.php';
	$templates[] = $slug . '.php';

	// Allow template parst to be filtered
	$templates = apply_filters( 'bbp_get_template_part', $templates, $slug, $name );

	// Return the part that is found
	return bbp_locate_template( $templates, true, false );
}

Changelog

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