无法在wordpress中排列更新的style.css更改

时间:2017-11-09 16:40:53

标签: php wordpress

我无法加载我在wordpress主题中制作的更新的style.css更改,它会删除该文件的旧版本/忽略我已制作/保存的任何新更改。

在我的主题文件夹" humescores"根目录下的functions.php中我有这个来排队我的样式表

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' );

目录结构

enter image description here

4 个答案:

答案 0 :(得分:2)

试试这个,

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' );

答案 1 :(得分:1)

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

答案 2 :(得分:1)

First确保您选择正确的方式致电style.css file,您可以致电style file with two method

  1. wp_head()功能位于页面顶部或call the function name in the header page that call style files or scripts files

    在您的情况下,您的函数名称为humescores_scripts(),请调用此方法 标题页中的函数

    <?php humescores_scripts(); ?>
    
  2. 您也可以在标题页中调用主样式文件

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

    确认此操作后,从键盘按shift+f5fn+f5以刷新并重新下载浏览器中的文件缓存

答案 3 :(得分:0)

发现问题

谷歌铬决定忽略更改(因为更改太小,我编辑的所有内容都是h1标签颜色)所以我清除了浏览器缓存,并刷新了页面,它现在有效了

https://codex.wordpress.org/I_Make_Changes_and_Nothing_Happens