January 20th, 2019 at 16:06 #72886
yesterday, I went with a child theme since there are some changes I want to do that would require some changes in the theme files.
In your child theme tutorial I have read that you just copy the (complete) wanted file with the identical file name to the child theme folder (with the folders) and then edit the files there as much as you want. Is that it? Or would I have to declare somewhere that the child theme should use the newly added theme files?
Before I went with the child theme, I did some minor changes to the parents files (certain stylings of the comment sections that I could not solve with the CSS box alone). Then, after adding the child theme, I copied the files like that to the child theme folder and changed a few more things over there. Those things were not shown on the website though, they would only be visible after changing them in the parent theme, too.
Is it now since the coding was already too specific in the parent theme that it would not see the child theme files as more specific? Or is this caused by something else?
And how would I override a file that is not particularly in the theme “Nirvana” folder such as “wp-content/languages/themes/nirvana-de_DE.po”?
Website: earth-renewing.comFebruary 4th, 2019 at 17:23 #73360ZedCryout Creations Team
Some files (which are recognized by WordPress, like functions.php, templates, content templates: page.php, index.php, post.php, archive.php, so on) are automatically detected when present in the child theme folder.
Other files (everything that’s not a core file and we’ve added to the theme ourselves) is not automatically picked up. These files can sometimes be included using additional inclusion calls, or their individual functions can be overridden by simply being present in the child theme files.
As a general rule, the child theme should contain as little content as possible (code, style) to maintain best compatibility with future theme updates. Try to avoid copying whole files (especially the style or functions file) directly from the parent theme.February 4th, 2019 at 21:44 #73381
Is “wp-content/languages/themes/nirvana-de_DE.po” a theme specific file?
What kind of inclusion calls do you mean?
Sometimes, changes need to be done at a very specific position. Let’s say in the formular of the comments section (to change some styling here that was not gripping through the open CSS window in the Nirvana settings). How would it be overridden if I would take the file containing only the part with the updated formular? Would this be recognized?February 23rd, 2019 at 16:27 #74538ZedCryout Creations Team
The file path you indicated is not inside the theme’s folder.
There is no catch-all solution.
Some customizations can be achieved solely with CSS (which doesn’t require any file edits to accomplish).
Other customizations require adjusting code:
– if that’s WordPress core functionality then there’s usually a filter or an action that can be used to connect your custom code to;
– if it’s theme functionality sometimes there is a filter or action hook available, other times the whole function providing the functionality is pluggable and in some cases the change requires entire files to be replaced (via the child theme).
The simplest/best solution varies on a case-by-case basis.February 24th, 2019 at 14:55 #74575
The topic ‘Overriding Theme Files with a Child Theme’ is closed to new replies.