Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从插件wordpress文件夹获取文件路径_Wordpress_Twitter Bootstrap - Fatal编程技术网

如何从插件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