如何在WordPress中创建子主题? [英] How to create a child theme in WordPress?

查看:47
本文介绍了如何在WordPress中创建子主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to create a child theme so I can customize the parent theme but it is not working what-so-ever. I did everything I can think of:

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

  1. created a folder for my child theme under wp-content/themes
  2. created a style.css stylesheet and saved it in the child theme folder:

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

  • ,然后转到外观"> WordPress中的主题,但未显示任何子主题.我已经尝试了多次,不知道该怎么办.

  • and I went to Appearance > Themes in WordPress but no child theme showed up. I have tried it multiple times and don't know what to do.

    推荐答案

    此处非常不错的教程: https://www.elegantthemes.com/blog/resources/wordpress-儿童主题教程.我从其中摘录了 style.css 文件,并用您的信息替换了一些位:

    Pretty good tutorial here: https://www.elegantthemes.com/blog/resources/wordpress-child-theme-tutorial. I've taken a snippet from it for the style.css file, and substituted bits with your info:

    /*
     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 );确保您使用的路径正确.然后,您可以正常访问外观>主题".

    Be sure to link properly to the TwentyThirteen theme's style.css file (via @import); make sure you're using the right path. Then you can proceed as normal by visiting "Appearance > Themes".

    这篇关于如何在WordPress中创建子主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆