WordPress Child Theme - General Understanding

前端 未结 2 1418
有刺的猬
有刺的猬 2021-01-22 15:00

I am trying to understand how to use a Child Theme in wordpress. I am afraid that something will go wrong in the process of developpment because I haven\'t completely understood

2条回答
  •  情歌与酒
    2021-01-22 15:10

    Think of the child theme as a layer on top of the parent theme. By default (if you add nothing to the child theme other than a style.css file), all the templates from the parent theme will be used. The only thing you have to have is the style.css file. If you wanted to override the page.php template for instance, you would simply just make a page.php file in your child directory and WordPress will use that template instead of the parent template. Same goes for any template file or template part.

    You can have a functions.php file in your child theme and it will be included in addition to the parent functions file.

    Usually the parent's style.css file would be enqueued before the child's style.css file, but it depends on how those files get enqueued. The system is quite flexible.

提交回复
热议问题