admin管理员组文章数量:1314039
It's my first time working with WordPress. I have created a child theme in order to style a footer better.
I've added custom style to style.css
and it worked great until it didn't. Now, all of a sudden, it doesn't load any changes I make to style.css
.
I have even deleted style.css
and nothing changed.
How can I fix it ? I've cleared my cache, I've reloaded using CTRL+F5. This is localhost on XAMPP.
I can't clear the cache every time I make a change to style.css
and I will make a lot of changes to style.css
until the website is finished.
This is my functions.php
:
<?php
// add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
// function enqueue_parent_styles() {
// wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
// }
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_uri(), NULL, filemtime( get_stylesheet_directory() . '/style.css' ) );
}
?>
I have found this answer:
But I have no idea where to put the code:
<?php
$file = get_bloginfo( 'stylesheet_url' )
. '?' . filemtime( get_stylesheet_directory() . '/style.css' );
?>
<link rel="stylesheet" href="<?php echo $file; ?>" type="text/css" />
In what file does that go ?
It's my first time working with WordPress. I have created a child theme in order to style a footer better.
I've added custom style to style.css
and it worked great until it didn't. Now, all of a sudden, it doesn't load any changes I make to style.css
.
I have even deleted style.css
and nothing changed.
How can I fix it ? I've cleared my cache, I've reloaded using CTRL+F5. This is localhost on XAMPP.
I can't clear the cache every time I make a change to style.css
and I will make a lot of changes to style.css
until the website is finished.
This is my functions.php
:
<?php
// add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
// function enqueue_parent_styles() {
// wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
// }
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_uri(), NULL, filemtime( get_stylesheet_directory() . '/style.css' ) );
}
?>
I have found this answer: https://wordpress.stackexchange/a/173076/198154
But I have no idea where to put the code:
<?php
$file = get_bloginfo( 'stylesheet_url' )
. '?' . filemtime( get_stylesheet_directory() . '/style.css' );
?>
<link rel="stylesheet" href="<?php echo $file; ?>" type="text/css" />
In what file does that go ?
Share Improve this question edited Nov 27, 2020 at 11:31 Jorje12 asked Nov 27, 2020 at 11:11 Jorje12Jorje12 1033 bronze badges1 Answer
Reset to default 0Try this:
function enqueue_child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_uri() . '?v=' . filemtime( get_stylesheet_directory() . '/style.css' ) );
}
本文标签: csschildtheme style not changing on localhost
版权声明:本文标题:css - child-theme style not changing on localhost 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741959540a2407192.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论