Forums

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

Home Forums Back End how to use php files on WordPress child themes

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #161966
    AlirezaM
    Participant

    Hi everybody!

    I was playing around WordPress child themes (how to make and use them) , and I got how to use child themes to overwrite the css stylesheets completely, now the problem I have is about calling php files from child themes, for example:

    I have a php file on this location:

    wp-content/themes/theme-name/framework/widgets/a.php

    and now I want to put another a.php on child theme folder and make it in a way that overwrites the main file, I put it here but it doesn’t work:

    wp-content/themes/theme-name-child/framework/widgets/a.php

    Just notice that I’m just putting the same file with a little different lines on child theme category and I don’t write or add any php lines inside a file.

    Please help me to make this working.

    Thanks in advance!

    Alireza

    #190364
    LewisCowles1986
    Participant

    Wow, in the odd chance you still need to know this, or someone else needs to know and nobody has answered, you should check out these links

    WordPress Codex on Child Themes – Using functions.php
    How to modify the parent theme behaviour within the child theme

    Basically you may not be able to do this depending upon your theme, in which case it may be easier to manually import functionality using require_once. This may be a lot more difficult as often commercial or freemium theme builders have no concept of separation of concerns, and may have limited widgets to working within their framework. In this case it may be more efficient to drop the project, but with awesome tools like netbeans you can find where variables, defines and functions are created by opening as a project, and then take the arduous journey of re-creating a compatible environment for the theme features you need. (i.e. defining necesarry constants, compatible objects etc)

    9/10 it’s not worth it, components should not be bundled like this with the theme unless they do not want you using them…

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