Re: Code Snippets: Storing plugin theme files in the plugin dir (1.2)
I also added this
function bp_classifieds_enqueue_url($file){
// split template name at the slashes
$stylesheet_path = get_stylesheet_directory_uri();
$suffix = explode($stylesheet_path,$file);
$suffix_str=$suffix[1];
$file_path_to_check = BP_CLASSIFIEDS_PLUGIN_DIR . ‘/theme’.$suffix_str;
$file_url_to_return = BP_CLASSIFIEDS_PLUGIN_URL . ‘/theme’.$suffix_str;
if ( file_exists($file)) {
return $file;
}elseif ( file_exists($file_path_to_check)) {
return $file_url_to_return;
}
}
add_filter( ‘bp_classifieds_enqueue_url’, ‘bp_classifieds_enqueue_url’ );
to filter the enqueued styles/scripts when they use get_stylesheet_directory_uri() :
wp_enqueue_style( ‘bp-classifieds-screen’, apply_filters(‘bp_classifieds_enqueue_url’,get_stylesheet_directory_uri() . ‘/classifieds/style.css’));