1

Themes designed for the Editor, such as the Twenty Twenty-Three theme, come with various Template Parts (such as a Header, Footer, and Post Meta) and Templates (such as Home, Index, Search, 404) for various pages.

What is the correct way to manage these Templates and Template Parts to reduce the chance of issues when the theme is updated? Is it safe to edit these Template Parts and Templates directly, overwriting the ones that come with the theme? Or should I make copies, edit those, and then use the copies for the various pages? Or is there some other approach that is better?

5
  • 2
    That's what child themes is for, exactly for the purpose that you need. developer.wordpress.org/themes/advanced-topics/child-themes, this link goes everything you need to know to get started Nov 6, 2022 at 13:23
  • A child theme can also be used to crud a block theme, first I would suggest going over the official block theme developmemt, developer.wordpress.org/themes/block-themes, this will give you the tools for working with a block theme. After you're done with that, you can use this with combination of a child theme to edit existing block themes Nov 6, 2022 at 22:38
  • @Buttered_Toast I'm looking at two points on that page: With a block theme, the user can edit all parts of their website without code and By using the Styles interface, users can customize colors and typography for the website and for the blocks. This is making it seem like I don't need a child theme to safely edit the Templates and Template Parts. That seems to be supported by the Site Editor documentation but it's still not totally clear what happens to edits to a theme's Templates or Template Parts when the theme gets updated. Nov 7, 2022 at 1:15
  • 1
    Nothing has changed about the way themes are updated. If there's an update all files are replaced so you'd lose any changes. Changes made by users in the editor are saved in the database, and I believe they can be exported, but if you want to make permanent changes to the theme with code you'll need to create a child theme. I am not certain, but I believe template parts in block themes are supported by child themes. This may help: learn.wordpress.org/lesson-plan/… Nov 7, 2022 at 2:58
  • @JacobPeattie If changes made in the Site Editor are saved to the database, they should persist across updates to the theme. As long as I don't edit a theme's PHP, JS, or PHP files, I don't need to make a child theme if the only changes I'm making are in the Site Editor. As soon as I touch one of the source files for the theme, though, that will get overwritten on an update and I'd need a child theme. Nov 7, 2022 at 11:42

1 Answer 1

2

Must be create a child theme otherwise when you update theme then all modification file will be remove.

Here is the best tutorial for how to make a WordPress child theme https://www.elegantthemes.com/blog/resources/wordpress-child-theme-tutorial

2
  • I noticed that post is from 2013. Is that still the best way to create a child theme? I'll be double checking with the official documentation, but it seems like if creating a child theme is the best approach to make variations on the premade themes, it should be a whole lot easier than those steps are. Nov 6, 2022 at 19:04
  • I've (perhaps temporarily) removed the accept. After working through that page, it seems like making a child theme is only for editing the CSS, JS, and PHP files associated with the theme. I see no evidence that a child theme is required when using the block editor and Full Site Editor to change Template and Template Part files. The Wordpress official documentation also talks about making child themes to edit the CSS, JS, and PHP files safely. Can you please point to something that the effort of making a child theme is required to use Full Site Editing? Nov 6, 2022 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.