child-theme style not changing on localhost


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:

// 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:

$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 ?

Jorje12 2 months 0 Answers 11 views 0

Leave an answer