Php Can';t将更新的style.css更改排入wordpress
我无法加载我在wordpress主题中所做的较新的style.css更改,它会拉取该文件的旧版本/忽略我所做/保存的任何新更改 在我的主题文件夹“humescores”根目录下的functions.php中,我有一个用于将我的样式表排队的文件Php Can';t将更新的style.css更改排入wordpress,php,wordpress,Php,Wordpress,我无法加载我在wordpress主题中所做的较新的style.css更改,它会拉取该文件的旧版本/忽略我所做/保存的任何新更改 在我的主题文件夹“humescores”根目录下的functions.php中,我有一个用于将我的样式表排队的文件 function humescores_scripts() { //Enqueue Google fonts: Source Sans Pro and PT Serif wp_enqueue_style('humescore
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' );
目录结构
发现问题
google chromium决定忽略更改(因为更改太小,我只编辑了一个h1
tags颜色),所以我清除了浏览器缓存,刷新了页面,现在就可以了
发现问题
google chromium决定忽略更改(因为更改太小,我只编辑了一个h1
tags颜色),所以我清除了浏览器缓存,刷新了页面,现在就可以了
首先
确保您编写了调用style.css文件的正确路径
您可以使用两种方法调用样式文件
wp_head()
函数在页面的头部,或调用标题页中调用样式文件或脚本文件的函数名
在您的情况下,函数名是humescores\u scripts()
调用此函数
标题页中的函数
<?php humescores_scripts(); ?>
<?php wp_enqueue_style( 'style', get_stylesheet_uri() );?>
<?php humescores_scripts(); ?>
<?php wp_enqueue_style( 'style', get_stylesheet_uri() );?>
确保完成此操作后,从键盘上按shift+f5或刷新并重新下载浏览器中的文件缓存
首先
确保您编写了调用style.css文件的正确路径
您可以使用两种方法调用style文件
wp_head()
函数在页面的头部,或调用标题页中调用样式文件或脚本文件的函数名
在您的情况下,函数名是humescores\u scripts()
调用此函数
标题页中的函数
<?php humescores_scripts(); ?>
<?php wp_enqueue_style( 'style', get_stylesheet_uri() );?>
<?php humescores_scripts(); ?>
<?php wp_enqueue_style( 'style', get_stylesheet_uri() );?>
确认后,按键盘上的shift+f5或f5刷新并重新下载浏览器中的文件缓存
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' );
试试这个
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' );
在事实发生后通过浏览器同步加载Google Chrome和Google Chrome,我没有清除chromes缓存,它仍然存在原始问题,但Chrome在清除缓存后没有,因此我知道这是一个浏览器问题。在事实发生后,通过浏览器同步加载Google Chrome和Google Chrome,我没有清除chromes缓存,它仍然有原始问题,但Chrome在清除缓存后没有,所以这就是我如何知道它是一个浏览器问题。好吧,我实际上在想强制清除缓存快捷键是什么。我的排队风格有什么问题吗代码>它不是做了同样的事情吗?我在
标题页中编辑我的答案调用你的函数名
@Kagerjayah好的,我实际上在想强制清除缓存快捷键是什么。我的排队风格有什么问题吗代码>它不是做了同样的事情吗?我在标题页编辑我的答案调用你的函数名
@Kagerjaywhat与我的排队方式有什么问题,尽管wp_排队方式('humescores style',get_stylesheet_uri())代码>它不是做了同样的事情吗?我的排队风格有什么问题吗代码>它不是做同样的事情吗?