bp_register_theme_package( array $theme = array(), bool $override = true )

Register a new BuddyPress theme package in the active theme packages array.


Description Description

For an example of how this function is used, see: BuddyPress::register_theme_packages().

See also See also


Top ↑

Parameters Parameters

$theme

(Optional) See BP_Theme_Compat.

Default value: array()

$override

(Optional) If true, overrides whatever package is currently set. Default: true.

Default value: true


Top ↑

Source Source

File: bp-core/bp-core-theme-compatibility.php

function bp_register_theme_package( $theme = array(), $override = true ) {

	// Create new BP_Theme_Compat object from the $theme array.
	if ( is_array( $theme ) ) {
		$theme = new BP_Theme_Compat( $theme );
	}

	// Bail if $theme isn't a proper object.
	if ( ! is_a( $theme, 'BP_Theme_Compat' ) ) {
		return;
	}

	// Load up BuddyPress.
	$bp = buddypress();

	// Only set if the theme package was not previously registered or if the
	// override flag is set.
	if ( empty( $bp->theme_compat->packages[$theme->id] ) || ( true === $override ) ) {
		$bp->theme_compat->packages[$theme->id] = $theme;
	}
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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