admin管理员组文章数量:1122846
I looked at this question:
plugin css is not being applied to the page?
but I couldnt solve my problem.
I use below code like the question:
<?php
function libload()
{
wp_register_style( 'foo-styles', plugin_dir_url( __FILE__ ) . 'dahili/bootstrap.min.css' );
wp_enqueue_style( 'foo-styles' );
wp_register_style( 'foo-styles2', plugin_dir_url( __FILE__ ) . 'dahili/style.css' );
wp_enqueue_style( 'foo-styles2' );
wp_register_style( 'foo-styles3', plugin_dir_url( __FILE__ ) . 'dahili/responsive.css' );
wp_enqueue_style( 'foo-styles3' );
}
add_action('wp_enqueue_scripts','libload');
?>
style files are loading as you can see below link but wp not apply them:
/sample-page/
How can I solve this problem?
I looked at this question:
plugin css is not being applied to the page?
but I couldnt solve my problem.
I use below code like the question:
<?php
function libload()
{
wp_register_style( 'foo-styles', plugin_dir_url( __FILE__ ) . 'dahili/bootstrap.min.css' );
wp_enqueue_style( 'foo-styles' );
wp_register_style( 'foo-styles2', plugin_dir_url( __FILE__ ) . 'dahili/style.css' );
wp_enqueue_style( 'foo-styles2' );
wp_register_style( 'foo-styles3', plugin_dir_url( __FILE__ ) . 'dahili/responsive.css' );
wp_enqueue_style( 'foo-styles3' );
}
add_action('wp_enqueue_scripts','libload');
?>
style files are loading as you can see below link but wp not apply them:
http://www.hekim.deniz-tasarim.site/sample-page/
How can I solve this problem?
Share Improve this question asked Apr 13, 2020 at 18:27 Faruk rızaFaruk rıza 982 silver badges11 bronze badges 2- 1 No, the style files are not loading. If you view your source, those files aren't listed. What file is your code running in? Is the plugin active? – WebElaine Commented Apr 13, 2020 at 18:38
- @WebElaine yes, plugin is active.I need all css files – Faruk rıza Commented Apr 13, 2020 at 18:41
3 Answers
Reset to default 1Change integratation code with this:
<?php
wp_register_style( 'foo-styles', plugin_dir_url( __FILE__ ) . 'dahili/bootstrap.min.css' );
wp_enqueue_style( 'foo-styles' );
wp_register_style( 'foo-styles2', plugin_dir_url( __FILE__ ) . 'dahili/style.css' );
wp_enqueue_style( 'foo-styles2' );
wp_register_style( 'foo-styles3', plugin_dir_url( __FILE__ ) . 'dahili/responsive.css' );
wp_enqueue_style( 'foo-styles3' );
?>
Your code looks correct, but the page you linked to doesn't seem to have them included.
This means that this line is not being run:
add_action('wp_enqueue_scripts','libload');
Check if the php file that you have it inside of is included by one of your plugin files?
Or that you are trying to include a file with the wrong path.
Check that the file is in a plugin not a theme folder, or you will need a different path.
I ran into the same problem and there was a naming conflict in a different plugin with the alias in the first argument in wp_enqueue_style(); Wordpress should really have some error handling for this. I went a month until I realized that could be the problem. look into this bit of documentation here
本文标签: wp enqueue scriptplugin css is not being applied to the page
版权声明:本文标题:wp enqueue script - plugin css is not being applied to the page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736303231a1931812.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论