a template question
-
Hi; i’m creating a new plugin that uses templates.
I don’t like the fact that when you install a BP plugin, you have to move its templates to the current theme directory.
So I would like to do this :
check if the current theme has specific templates for the plugin
if not, load the templates that are INSIDE the plugin directory.
I try with this
define ( ‘BP_MYPLUGIN_NAME’, ‘bp-myplugin’ );
define ( ‘BP_MYPLUGIN_DIR’, WP_PLUGIN_DIR . ‘/’ . BP_MYPLUGIN_NAME );
define ( ‘BP_MYPLUGIN_URL’, WP_PLUGIN_URL . ‘/’ . BP_MYPLUGIN_NAME );
*********
if ( !locate_template( array( ‘BP_MYPLUGIN_NAME.’/create.php’ ), false ))
load_template(apply_filters( ‘my_plugin_template_create’, BP_MYPLUGIN_DIR.’/theme/create’));
else
bp_core_load_template( apply_filters( ‘my_plugin_template_create’, ‘BP_MYPLUGIN_NAME.’/create’ ) );
But it does not work.
Could anyone help ?
Thanks !
- The topic ‘a template question’ is closed to new replies.