Avada 自定义 css 设置未生效



我遇到了各种错误,标题图像没有改变,自定义css(在avada或子主题中制作(没有任何效果。我正在Wordpress(版本4.9.8(上全新安装Avada(5.6.2(,并且在进行小更改时已经出现了各种错误。我托管在 wpengine 上。

如何解决这个问题?这是缓存问题还是服务器或其他问题?

您是否正确设置了以下两个选项?

风格.css在儿童:

/*
Theme Name:   Twenty Fifteen Child
Theme URI:    http://example.com/twenty-fifteen-child/
Description:  Twenty Fifteen Child Theme
Author:       John Doe
Author URI:   http://example.com
Template:     twentyfifteen
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain:  twenty-fifteen-child
*/

功能.php在儿童中:

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>

取自: https://codex.wordpress.org/Child_Themes

然后,您是否将要使用的样式表排队?

<?php
function my_theme_enqueue_styles() {
$parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>

第一件事 你可能做了,但没有帮助一点。

  1. AVADA/选项/性能/向下滚动到"重置 AVADA 缓存">
  2. 如果安装了自动优化,
  3. 请查看顶部的WP管理菜单,将鼠标悬停在"自动优化"上,然后单击清除CSS/JS缓存

现在有趣的东西。

如果您正在编辑 - Avada/选项/自定义 css,
  1. 请确保在顶部 wp 菜单中选择了"显示所有语言",如果您偶然选择了"德语"并在那里对 Avada 自定义 css 进行更改,这些更改永远不会显示在英文版本的页面上,英文页面将有旧的 css, 因此,请确保您使用的是"所有语言",这将更新所有语言。这也会影响某些插件等。

  2. 更有趣的事情是,只有当您登录时,您的自定义CSS才会显示在页面上。当您注销时,您将看到旧的css。这是因为 avada 将此 Css 存储到页面源代码中而不是单独的 css 中,并且虚拟主机倾向于将这些内容缓存在 cloudflare 或 nginx 缓存或这些东西中。您可以通过转到 chrome 中的 www.page.com 轻松检查这一点,右键单击以显示源代码并查看自定义 css,然后转到 www.page.com?v=1(刚刚添加随机参数更改链接(,右键单击检查页面源代码,如果您在这里看到新 css 但在原始页面上看到旧,托管缓存会导致您的问题。解决方案1- 等待一天,它最终会改变(无聊的权利(解决方案2- 转到主页的编辑页面并更新/保存它,即使没有实际更改(或在:D某处添加空格(,这将强制页面源刷新。

最新更新