Vincent Tang
Vincent Tang

Reputation: 4170

Can't enqueue newer style.css changes in wordpress

I can't load newer style.css changes I've made into my wordpress theme, its pulling an older version of that file / ignoring any new changes I've made/saved.

In functions.php under the root of my theme folder "humescores" I have this to enqueue my stylesheets

function humescores_scripts() {
        //Enqueue Google fonts: Source Sans Pro and PT Serif
        wp_enqueue_style('humescores-fonts','https://fonts.googleapis.com/css?family=PT+Serif:400,400i,700,700i|Source+Sans+Pro:400,400i,600,900');

    //Connects style.css
    wp_enqueue_style( 'humescores-style', get_stylesheet_uri() );

    wp_enqueue_script( 'humescores-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );

    wp_enqueue_script( 'humescores-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
        wp_enqueue_script( 'comment-reply' );
    }
}
add_action( 'wp_enqueue_scripts', 'humescores_scripts' );

Directory Structure

enter image description here

Upvotes: 0

Views: 481

Answers (4)

Pooja Ghetia
Pooja Ghetia

Reputation: 77

Try this,

function humescores_scripts() {
        //Enqueue Google fonts: Source Sans Pro and PT Serif
        wp_enqueue_style('humescores-fonts','https://fonts.googleapis.com/css?family=PT+Serif:400,400i,700,700i|Source+Sans+Pro:400,400i,600,900');

    //Connects style.css
    wp_enqueue_style( 'humescores-style', get_stylesheet_uri(), array(), time());

    wp_enqueue_script( 'humescores-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );

    wp_enqueue_script( 'humescores-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
        wp_enqueue_script( 'comment-reply' );
    }
}
add_action( 'wp_enqueue_scripts', 'humescores_scripts' );

Upvotes: 2

Eng_Farghly
Eng_Farghly

Reputation: 3007

First make sure you write the right path to call style.css file you can call style file with two method

  1. wp_head() function in the head of the page or call the function name in the header page that call style files or scripts files

    In your case your function name is humescores_scripts() call this function in the header page

    <?php humescores_scripts(); ?>
    

you can also call the main style file in the header page

<?php wp_enqueue_style( 'style', get_stylesheet_uri() );?>

After making sure of this press shift+f5 or fn+f5 from keyboard to refresh and redownload the cache of files in browser

Upvotes: 1

Vincent Tang
Vincent Tang

Reputation: 4170

found problem

google chromium decided to ignore changes (because the changes were so small, all I edited was an h1 tags color) so I cleared out my browser cache, and refreshed page, it works now

https://codex.wordpress.org/I_Make_Changes_and_Nothing_Happens

Upvotes: 0

Sco
Sco

Reputation: 759

wp_enqueue_style('YOUR_NAME_STYLE', get_template_directory_uri() . '/style.css');

Upvotes: 1

Related Questions