【问题标题】:Wordpress ?ver=### not loading the latest child-theme styles sheetWordpress ?ver=### 未加载最新的子主题样式表
【发布时间】:2018-07-02 12:07:17
【问题描述】:

我有一个带有子主题的 WordPress 主题。编辑并保存子样式表后,我看不到更改。查看源代码,样式表已加载,但末尾有这个版本:style.css?ver=4.9.7

现在,当我加载 style.css 时会显示样式,但会显示带有 cmets 的空文件(第一次获得主题时的原始文件)style.css?ver=4.9.7

我知道鼓励在子主题中使用自定义样式,但是为什么 WordPress 不支持呢?

感谢任何建议或帮助。谢谢。

【问题讨论】:

    标签: wordpress wordpress-theming


    【解决方案1】:

    此版本添加在function.php文件中,请先查看

    function.php 上更好的入队样式,像这样

    function child_themes_styles() {
       wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array(), wp_get_theme()->get('Version'));
    }
    
    add_action( 'wp_enqueue_scripts', 'child_themes_styles' );
    

    【讨论】:

      猜你喜欢
      • 2012-01-10
      • 2016-03-04
      • 1970-01-01
      • 2020-09-13
      • 1970-01-01
      • 1970-01-01
      • 2018-10-28
      • 2014-10-13
      • 2013-07-13
      相关资源
      最近更新 更多