Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: a template question


grosbouff
Participant

@grosbouff

(PS : the problem will be the same with the loaded CSS and JS files. You should really add something to the buddypress core to make this easier).

Here’s how I did to load CSS & JS from the plugin directory (default) if there’s no files for the plugin into the current theme :

define ( ‘BP_QUICKPRESS_PLUGIN_NAME’, ‘buddypress-quickpress’ );

define ( ‘BP_QUICKPRESS_PLUGIN_URL’, WP_PLUGIN_URL . ‘/’ . BP_QUICKPRESS_PLUGIN_NAME );

wp_enqueue_script( ‘bp-quickpress-expandable-tree-js’, apply_filters(‘bp_quickpress_locate_js’,’_inc/js/expandableTree.js’),array(‘jquery’), ‘1.0’ );

wp_enqueue_style( ‘bp-quickpress-screen’, apply_filters(‘bp_quickpress_locate_css’,’style.css’) );

function bp_quickpress_load_template_files($file) {

$theme_path = STYLESHEETPATH . ‘/quickpress’;

$theme_url = get_stylesheet_directory_uri() . ‘/quickpress’;

if ( file_exists( $theme_path.’/’.$file ) ) {

return $theme_url.’/’.$file;

}else {

return BP_QUICKPRESS_PLUGIN_URL.’/theme/quickpress/’.$file;

}

}

add_filter(‘bp_quickpress_locate_js’,’bp_quickpress_load_template_files’);

add_filter(‘bp_quickpress_locate_css’,’bp_quickpress_load_template_files’);

Skip to toolbar