Overwriting parent’s theme files in WordPress

It seems like my WordPress child theme in some cases refuses to use child files and still uses parent’s files.

For example I want to override the themex.lesson that is located in the
child_theme/framework/classes/themex.lesson.php folder

Read More

Parent’s file is in the:

parent/framework/classes/themex.lesson.php folder

Changes that I make to the child_theme themex.lesson php are not reflected in live site. Other changes made to the child theme work perfectly fine.
What could be causing this behavior?

Related posts

Leave a Reply

1 comment

  1. Referencing / Including Files in Your Child Theme

    When you need to include files that reside within your child theme’s
    directory structure, you will use get_stylesheet_directory(). Because
    the parent template’s style.css is replaced by your child theme’s
    style.css, and your style.css resides in the root of your child
    theme’s subdirectory, get_stylesheet_directory() points to your child
    theme’s directory (not the parent theme’s directory).

    Here’s an example, using require_once, that shows how you can use
    get_stylesheet_directory when referencing a file stored within your
    child theme’s directory structure.

    require_once( get_stylesheet_directory() . '/my_included_file.php' );
    

    Source: https://codex.wordpress.org/Child_Themes