【问题标题】:How to create a child theme in WordPress?如何在 WordPress 中创建子主题?
【发布时间】:2017-04-16 20:56:31
【问题描述】:

我正在尝试创建一个子主题,以便我可以自定义父主题,但它无法正常工作。我做了我能想到的一切:

  1. wp-content/themes 下为我的子主题创建了一个文件夹
  2. 创建了一个style.css 样式表并将其保存在子主题文件夹中:

    /*
    Theme Name:   Twenty Thirteen Child Theme
    Description:  Twenty Thirteen Child Theme
    Author:       Ashley
    Template:     twentythirteen
    Version:      1.0.0
    */
    
  3. 然后我转到了 WordPress 中的外观 > 主题,但没有出现子主题。试了好几次都不知道怎么办。

【问题讨论】:

标签: css wordpress


【解决方案1】:

这里有很好的教程: https://www.elegantthemes.com/blog/resources/wordpress-child-theme-tutorial。我为style.css 文件提取了一个sn-p,并用您的信息替换了位:

/*
 Theme Name:   Twenty Thirteen Child Theme
 Description:  Twenty Thirteen Child Theme
 Author:       Ashley
 Template:     twentythirteen
 Version:      1.0.0
*/

@import url("../twentythirteen/style.css");

/* =Theme customization starts here
------------------------------------------------------- */

确保正确链接到 TwentyThirteen 主题的 style.css 文件(通过 @import);确保您使用正确的路径。然后您可以通过访问“外观 > 主题”正常进行操作。

【讨论】:

    【解决方案2】:

    这是一个简单的article

    • 创建子主题目录
    • 创建styles.css
    • 创建functions.php

    【讨论】:

      猜你喜欢
      • 2014-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-31
      • 2013-06-01
      • 2014-04-11
      • 2014-05-04
      相关资源
      最近更新 更多