如何从插件wordpress文件夹获取文件路径
您好,我想使用如何从插件wordpress文件夹获取文件路径,wordpress,twitter-bootstrap,Wordpress,Twitter Bootstrap,您好,我想使用wp\u enqueue\u style函数从插件wordpress文件夹中注册style.css文件,但不在目录文件夹中 例如,当我想从主题目录注册style.css时,我使用下面的代码 wp_enqueue_style ('bootstrap_css', get_template_directory_uri().'/css/bootstrap.min.css'); 上面的代码是从下面的目录注册bootstrap.min.css文件 /wamp/www/wordpress/wp
wp\u enqueue\u style
函数从插件wordpress文件夹中注册style.css
文件,但不在目录文件夹中
例如,当我想从主题目录注册style.css
时,我使用下面的代码
wp_enqueue_style ('bootstrap_css', get_template_directory_uri().'/css/bootstrap.min.css');
上面的代码是从下面的目录注册bootstrap.min.css
文件
/wamp/www/wordpress/wp-content/themes/my-themefolder/css/bootstrab.min.css
但我如何才能注册相同的文件时,我们下面的插件文件夹中的文件
/www/wordpress/wp-content/plugins/my-plugin/css/bootstrap.min.css
对于获取插件文件夹,我必须使用任何函数而不是get\u template\u directory\u uri()
?
要获取插件目录的绝对URL,请使用
此函数用于检索带有尾随斜杠的URL
要确保路径以尾部斜杠结束,请使用
plugins_url()
// http://www.example.com/wp-content/plugins
plugins_url( '', __FILE__ )
// http://www.example.com/wp-content/plugins/plugin
plugins_url( '/css/bootstrap.min.css', __FILE__ )
// http://www.example.com/wp-content/plugins/plugin/css/bootstrap.min.css
plugin_dir_url( __FILE__ )
// http://www.example.com/wp-content/plugins/plugin/
plugin_dir_url( __FILE__ ) . css/bootstrap.min.css
// http://www.example.com/wp-content/plugins/plugin/css/bootstrap.min.css