Loads BuddyPress Legacy Theme functionality.

This is not a real theme by WordPress standards, and is instead used as the fallback for any WordPress theme that does not have BuddyPress templates in it.

To make your custom theme BuddyPress compatible and customize the templates, you can copy these files into your theme without needing to merge anything together; BuddyPress should safely handle the rest.

See @link BP_Theme_Compat() for more.

since 1.7.0
package BuddyPress
subpackage BP_Theme_Compat
inherited_from \BP_Theme_Compat

 Methods

The main BuddyPress (Legacy) Loader.

__construct() 
since 1.7.0
inherited_from \BP_Theme_Compat::__construct()

Pass the $properties to the object on creation.

__construct(array $properties = array()
Inherited
since 1.7.0

Parameters

$properties

array

Array of properties for BP_Theme_Compat.

Get a theme's property.

__get(string $property) : mixed
Inherited
since 1.7.0

Parameters

$property

string

Property name.

Returns

mixedThe value of the property if it exists, otherwise an empty string.

Check a theme's property exists.

__isset(string $property) : boolean
Inherited
since 9.0.0

Parameters

$property

string

Property name.

Returns

booleanTrue if the property exists. False otherwise.

Set a theme's property.

__set(string $property, mixed $value) : boolean
Inherited
since 1.7.0

Parameters

$property

string

Property name.

$value

mixed

Property value.

Returns

booleanTrue on success, false on failure.

Adds the no-js class to the body tag.

add_nojs_body_class(array $classes) : array

This function ensures that the element will have the 'no-js' class by default. If you're using JavaScript for some visual functionality in your theme, and you want to provide noscript support, apply those styles to body.no-js.

The no-js class is removed by the JavaScript created in buddypress.js.

since 1.7.0

Parameters

$classes

array

Array of classes to append to body tag.

Returns

array$classes

Enqueue the required JavaScript files

enqueue_scripts() 
since 1.7.0

Load the theme CSS

enqueue_styles() 
since 1.7.0
since 2.3.0 Support custom CSS file named after the current theme or parent theme.

Load localizations for topic script.

localize_scripts() 

These localizations require information that may not be loaded even by init.

since 1.7.0

Add secondary avatar image to this activity stream's record, if supported.

secondary_avatars(string $action, \BP_Activity_Activity $activity) : string
since 1.7.0

Parameters

$action

string

The text of this activity.

$activity

\BP_Activity_Activity

Activity object.

Returns

string

Outputs sitewide notices markup in the footer.

sitewide_notices() 
since 1.7.0
see

Filter the default theme compatibility root template hierarchy, and prepend a page template to the front if it's set.

theme_compat_page_templates(array $templates = array()) : array
see
since 2.2.0

Parameters

$templates

array

Array of templates. to use the defined page template for component's directory and its single items

Returns

array

Setup the theme hooks.

setup_actions() 

Meant to be overridden in your class. See BP_Legacy::setup_actions() for an example.

since 1.7.0
inherited_from \BP_Theme_Compat::setup_actions()

Set up theme hooks for your template package.

setup_actions() 
Inherited

Meant to be overridden in your class. See BP_Legacy::setup_actions() for an example.

since 1.7.0

Component global variables.

setup_globals() 

You'll want to customize the values in here, so they match whatever your needs are.

since 1.7.0
inherited_from \BP_Theme_Compat::setup_globals()

Set up global data for your template package.

setup_globals() 
Inherited

Meant to be overridden in your class. See BP_Legacy::setup_globals() for an example.

since 1.7.0

Set up the BuddyPress-specific theme compat methods.

start() 
Inherited

Themes should use this method in their constructor.

since 1.7.0

Get the URL and handle of a web-accessible CSS or JS asset

locate_asset_in_stack(string $file, string $type = 'css', string $script_handle = '') : array

We provide two levels of customizability with respect to where CSS and JS files can be stored: (1) the child theme/parent theme/theme compat hierarchy, and (2) the "template stack" of /buddypress/css/, /community/css/, and /css/. In this way, CSS and JS assets can be overloaded, and default versions provided, in exactly the same way as corresponding PHP templates.

We are duplicating some of the logic that is currently found in bp_locate_template() and the _template_stack() functions. Those functions were built with PHP templates in mind, and will require refactoring in order to provide "stack" functionality for assets that must be accessible both using file_exists() (the file path) and at a public URI.

This method is marked private, with the understanding that the implementation is subject to change or removal in an upcoming release, in favor of a unified _template_stack() system. Plugin and theme authors should not attempt to use what follows.

since 1.8.0

Parameters

$file

string

A filename like buddypress.css.

$type

string

Optional. Either "js" or "css" (the default).

$script_handle

string

Optional. If set, used as the script name in wp_enqueue_script.

Returns

arrayAn array of data for the wp_enqueue_* function: 'handle' (eg 'bp-child-css') and a 'location' (the URI of the asset)

 Properties

 

Template package properties, as passed to the constructor.

$_data : array

Default

array()
since 1.7.0