首页 文章

Wordpress自定义CSS路径

提问于
浏览
0

我'm not sure if this is a wider issue with Wordpress or just with the HTML5 Blank theme I'米使用但基本上 functions.php 正在寻找 /style.css . 当我将CSS文件保存在一个文件夹中时,我希望主题能够镜像我的静态HTML模板 . 我尝试修改以下内容:

function html5blank_styles()
{
    //wp_register_style('normalize', get_template_directory_uri() . '/normalize.css', array(), '1.0', 'all');
    //wp_enqueue_style('normalize'); // Enqueue it!

    wp_register_style('html5blank', get_template_directory_uri() . '/css/main.css', array(), '1.0', 'all');
    wp_enqueue_style('html5blank'); // Enqueue it!
}

这是对样式表的唯一引用,所以我想只需将名称/路径更改为我的工作,但它会导致主题不加载 .

有任何想法吗?或者我是以完全错误的方式来做这件事的?

1 回答

  • 1

    您可以通过 wp_register_style 自由连接其他CSS文件,但无法删除 style.css ,因为此文件是WordPress主题功能所必需的 . 但是,如果您不需要此文件中的样式,则可以从 style.css 中删除所有CSS代码,但保留WordPress主题所需的数据 . 所以你的 style.css 看起来像这样:

    /*
    Theme Name: WP Theme name
    Theme URI: https://wordpress.org/
    Author: Author
    Author URI: https://wordpress.org/
    Description: WP Theme.
    Version: 0.1
    */
    

相关问题