The problem your facing here can be solved by changing the function being used:
get_stylesheet_directory
will give you the directory of the current active theme, aka the location of the activestyle.css
get_template_directory
will give you the directory of the active theme, aka the parent theme
For most themes the two give the same result, but:
- Always use
get_stylesheet_directory
when referring to things in a child theme - Always use
get_template_directory
when in a parent theme - Always use
get_template_part
to load a template, never use the previous 2 function - Use
include
andrequire
to load a file that doesn’t contain a template such as a class or PHP include. If you need to override these, use hooks and actions to do this viaremove_action
etc - Minimise any cross talk between child themes and parent themes. A child theme shouldn’t be attempting to include files in a parent theme etc other than through
get_template_part