Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: a template question


grosbouff
Participant

@grosbouff

Hey DJPaul, thanks for your answer !

There something good for me in there :)

But, I still have a little problem.

In my plugin php files;

I use the bp_core_load_template() function to load my template, which is filtered by your (modified) function :

function classified3s_screen_filter_template( $located_template, $template_name ) {

if ( !empty( $located_template ) )

return $located_template;

if ( $bp->current_component != $bp->classified3s->slug )

return false;

$template_path = BP_CLASSIFIED3S_PLUGIN_DIR.”/theme/$template_name[0]”;

if ( file_exists( $template_path ) ) {

return $template_path;

}

return false;

}

add_filter( ‘bp_located_template’, ‘classified3s_screen_filter_template’, 10, 2 );

and it works.

So

bp_core_load_template( apply_filters( ‘classified3s_template_classified3s_directory’, ‘directories/classified3s/index’ ) );

loads the file inside myplugin/theme/classified3s/index.php because there is no specific themes files for the plugin in my current theme.

Great.

But inside that index.php file, I call another template :

<?php bp_core_load_template( apply_filters( ‘classified3s_template_classified3s_loop’, ‘classified3s/classified3s-loop.php’ ) );?>

which loads… nothing.

Don’t know if you can see where the problem is.

Thanks man !

Also, this should be added to the core function. Check if the plugin contains a “theme” directory where are stored the default template files if no templates are found in the current theme.

Because it’s annoying to have to move the files after having installed the plugin.

Skip to toolbar