Overriding Theme Files with a Child Theme

  • Author
  • #72886

    Power User

    Good day,

    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”?

    Kind regards,

    Website: earth-renewing.com

    • This topic was modified 1 month ago by  naomi.
    • This topic was modified 1 month ago by  naomi.

    Cryout 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.

    If you like our creations, help us share by rating them on WordPress.org.
    Please read the available documentation and search the forums before posting.

    Power User

    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?

Viewing 3 posts - 1 through 3 (of 3 total)

You need to log in to reply to this topic.