bp_get_template_part
Filters the template parts to be loaded.
Description
Parameters (3)
- 0. $templates (array)
- Array of templates located.
- 1. $slug (string)
- Template part slug requested.
- 2. $name (string)
- Template part name requested.
Usage
- To run the hook, copy the example below.
- $templates = apply_filters( 'bp_get_template_part', $templates, $slug, $name );
- if ( !empty( $templates ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the bp_get_template_part callback
- function filter_bp_get_template_part( $templates, $slug, $name ) {
- // make filter magic happen here...
- return $templates;
- };
- // add the filter
- add_filter( 'bp_get_template_part', 'filter_bp_get_template_part', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'bp_get_template_part', 'filter_bp_get_template_part', 10, 3 );
Defined (1)
The filter is defined in the following location(s).
- /bp-core/bp-core-template-loader.php
- $templates = apply_filters( 'bp_get_template_part', $templates, $slug, $name );