admin管理员组文章数量:1391951
I am calling my stylesheet styles.css
within functions.php
. Also adding add_action
. But it does not work…
<?php
function myBlog_files() {
wp_enqueue_style('styles', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'myBlog_files');
?>
styles.css
is on the same level as functions.php
in directory.
Do I need to call the function within index.php
or elsewhere?
Thanks
I am calling my stylesheet styles.css
within functions.php
. Also adding add_action
. But it does not work…
<?php
function myBlog_files() {
wp_enqueue_style('styles', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'myBlog_files');
?>
styles.css
is on the same level as functions.php
in directory.
Do I need to call the function within index.php
or elsewhere?
Thanks
Share Improve this question asked Mar 13, 2020 at 12:30 S.HS.H 1054 bronze badges 5 |1 Answer
Reset to default 0
- You can used to below snippet code for enqueue your css
<?php
function myBlog_files() {
wp_enqueue_style('styles', get_template_directory_uri()./style.css);
}
add_action('wp_enqueue_scripts', 'myBlog_files');
?>
- Add Your custom-style.css in another folder you add in folder name in before custom-style.css
For Example :
wp_enqueue_style('styles', get_template_directory_uri()./folder name/style.css);
Refer link for more knowledge
本文标签: cssStylesheet does not load despite functionsphp
版权声明:本文标题:css - Stylesheet does not load despite functions.php 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744671239a2618836.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
get_stylesheet_uri
it must bestyle.css
, astyle.css
is a mandatory file in a WP theme anyway. If you want to enqueue a file other thanstyle.css
you need to specify it, WP isn't psychic and needs to be told explicitly – Tom J Nowell ♦ Commented Mar 13, 2020 at 13:01