bp_gifts_load_template_filter
Bp_gifts_load_template_filter().
Description
bp_gifts_load_template_filter( $found_template, $templates );
You can define a custom load template filter for your component. This will allow
you to store and load template files from your plugin directory.
Parameters (2)
- 0. $found_template
- The found template.
- 1. $templates
- The templates.
Usage
if ( !function_exists( 'bp_gifts_load_template_filter' ) ) { require_once ABSPATH . PLUGINDIR . 'buddypress-gifts-latest-2014/includes/bp-gifts-core.php'; } // The found template. $found_template = null; // The templates. $templates = null; // NOTICE! Understand what this does before running. $result = bp_gifts_load_template_filter($found_template, $templates);
Defined (1)
The function is defined in the following location(s).
- /includes/bp-gifts-core.php
- function bp_gifts_load_template_filter( $found_template, $templates ) {
- global $bp;
- /**
- * Only filter the template location when we're on the gifts component pages.
- */
- if ( $bp->current_component != $bp->gifts->slug )
- return $found_template;
- foreach ( (array) $templates as $template ) {
- if ( file_exists( STYLESHEETPATH . '/' . $template ) )
- $filtered_templates[] = STYLESHEETPATH . '/' . $template;
- else
- $filtered_templates[] = dirname( __FILE__ ) . '/templates/' . $template;
- }
- $found_template = $filtered_templates[0];
- return apply_filters( 'bp_gifts_load_template_filter', $found_template );
- }