Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Translating using Child-Themes in WordPress

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #157547
    Alexander
    Participant

    Hello!

    Im currently working with WordPress and im translating my theme using a child theme. It works good, however how to deal with files that are located in parent theme sub-folders? Creating sub-folder with same file in the child theme doesnt seem to override the parent files.

    I really would like to avoid editing the parent themes files, but i really see no other option at the moment.

    Would like to future proof my theme with the ability to update WordPress without breaking my theme completely. How do you guys deal with translations for future proofing?

    Thanks!

    #157555
    Senff
    Participant

    I’m not exactly sure what folders you would be referring to, but location is not important with child themes — functionality is.

    (Meaning, if the parent theme has 153 CSS files in various locations, then that can be overriden by one CSS file in the child theme so to speak. Same for JS or PHP functions.)

    Can you give an example of what wouldn’t be overriden?

    #157557
    Alexander
    Participant

    Thanks for your answer!

    For example, lets say i have a parent theme called “Test”
    Within “Test” i have a folder called “Templates” where i would like to edit a file called related.php

    I would then copy that file and place it within my child theme called “Test-child”, which doesnt work.
    Neither does creating a identical folder called “Templates” and placing the file there. It still calls the related.php file from the parent theme.

    TL;DR
    All files that are located in the “root” of the parent theme can be overided successfully by placing copy in the “root” of the child theme. However files that are in sub-folders doesnt overide files in sub-folders of the child theme.

    I hope you understand what i mean. Thanks!

    #157573
    Senff
    Participant

    I think what you’re saying should work. To test, I’ve done the following.

    In my parent theme Twenty Thirteen, I created a folder called TEMPLATES and put a standard page template in there (new-page.php) called “NEW”.
    Created a test page that would use this particular “NEW” template.

    Then created a child theme called (twentythirteen-child), that also has a folder called TEMPLATES, that also contains new-page.php. Same as the original new-page.php, but with a green background.

    Then I activated the child theme, and made sure that the test page would still use “NEW” as its template.

    Turns out it DID take the new-page.php from the child theme! So this leads me to believe that as long as the folder name, file name and template name is the same, it will take the child theme’s version.

    Hmmmm….

    Maybe you’d need to republish the page?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Other’ is closed to new topics and replies.