Wordpress child theme of a child theme

纵然是瞬间 提交于 2020-05-29 07:44:21

问题


I'm using a theme what already is a child-theme of it's parent theme. Since I would like to make some changes, I want to make a child-theme.

How to make a child theme for a child theme?


回答1:


You can't really create a "grandchild" theme in the normal sense - i.e make it the child theme of a child theme. It might technically be possible (Smashing Magazine said it was back in 2013) but it seems to be generally considered to be not "Wordpress legit".

What you can do is create the grandchild theme as a plugin - although be aware that it tends to be considered as bad practice because it's an indication of bad architecture, and if you need a grandchild theme "something is wrong". However I can see the logic if you are using a third party theme that is itself a child theme.

Should you use a grandchild theme?

The main practical difficulties with grandchild themes are they they adds another level of "moving parts" into your site, making it more difficult to maintain and debug.

The references I've listed below discuss the practicalities and disadvantages of grandchild themes, so you can decide if this is still an option for you:

  • WP Smith: A Theme Framework, Child Themes, & Grandchild Themes
  • Justin Tadlock:
  • Tom J. Nowell's answer on wordpress.stackexchange.com to the question "Is it possible to make grandchild themes?"


How to create a "grandchild theme" using a plugin:

If you decide that this is the way to go, the following describe how to go about creating a plugin for your "grandchild theme"

  • Mark Barnes: Don’t edit child themes – use grandchild themes!

  • AppThemes: Creating Grandchild Themes

Alternatives to grandchild themes:

Another suggestion is to make a copy of the child theme to customise, although this means it's no longer easy to upgrade the child theme.

This article offers a way of editing the child theme in a way that "minimizes the coupling between the changes you make and the original child theme" ...meaning you don't need a grandchild theme and the changes to your child theme should (hopefully) be minimal, making it easier to upgrade.

  • Nelio Software: GrandChild Themes – Effective customization of Child-themes (based on Frameworks)


来源:https://stackoverflow.com/questions/46913744/wordpress-child-theme-of-a-child-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!