最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

css - Correct Way To Make Changes To A Wordpress Theme

programmeradmin3浏览0评论

I'm just getting started with WordPress development and trying to understand the correct way to change small elements within a page such as Woocommerce: How to remove page title from storefront theme homepage

Is creating a child theme standard in most WordPress site implementations? Or is it more common to add a lot of code to the Additional CSS section of the Theme Customization page?

I'm just getting started with WordPress development and trying to understand the correct way to change small elements within a page such as Woocommerce: How to remove page title from storefront theme homepage

Is creating a child theme standard in most WordPress site implementations? Or is it more common to add a lot of code to the Additional CSS section of the Theme Customization page?

Share Improve this question edited Feb 22, 2022 at 13:11 Adam asked Feb 16, 2022 at 18:45 AdamAdam 1034 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 3

If you're not the author of the parent theme, then it is better to create a child theme which overwrites the changes in the parent theme.

With a child theme, you can do more than just additional CSS, you can modify template layouts and add custom functions.

God was away for a long while but when he paid attention to earth again he created GIT ;)

Most themes (number out of thin air, but that is my experiance) do not understand that in order that "clients" will be able to use a child theme without worrying about future upgrades to the main theme breaking the site, the main theme has to have frozen interface which include APIs, hook usage and class usage. In practice this mostly means that any new updates are either a bug fixez or add functionality that have nothing to do with the already existing functionality of the theme. Few theme developers understand that, even fewer can manage to follow that rule.

Therefor it is not clear at all that the main advantage of child themes - being able to upgrade the main theme without breaking anythin, actually happens in real life.

If your changes are not trivial, you should concider creating a git repository, set the main theme on its own branch and have a separate branch for your production theme. When the main theme updates you can push the updates to its branch and merge them into your production branch.

If your site has many code modifications to the main theme, you might not going to bothere with that and just pick "manually" whatever security improvment there were in the main theme and ignore everything else.

This might be over your head right now if you just trying out wordpress development. In that case you might want to do it first in the "canonical" way with a child theme, but you are hopefully going to start using git if you haven't yet, and then it will take much less effort to just move to development model I described above.

发布评论

评论列表(0)

  1. 暂无评论