Is it possible to include folder from parent theme for child theme to use?

I have a folder in my parent theme that overrides how one plugin looks. If I don’t copy that folder to my child theme, the look of the child theme will be different from the parent theme.

Is it possible to somehow, in child theme’s functions.php file, include that folder (make child theme use that folder). I’ve searched all over but didn’t find anything.

Read More

The only way to make the child theme looks like the parent (that I can then modify) is to copy that folder in the child theme folder.

I tried with

$theme_folder = scandir(get_template_directory_uri().'/folder');

But I get the following warnings

Warning: scandir(...): failed to open dir: not implemented in functions.php on line 20

Warning: scandir(): (errno 9): Bad file descriptor in functions.php on line 20

And I’ve read that that may be because of lack of permissions on the server.

Related posts

Leave a Reply

2 comments

  1. if it were a styling problem, WordPress good practices said that styles should be added by enqueuing.

    https://codex.wordpress.org/Function_Reference/wp_enqueue_style

    You should try to confirm if your theme really do in that way and if your child theme does too.

    If your theme is overriding php template files, you just copy that folder to your child theme, edit what you want and delete unedited files.

    Anyway I recommend to check theme documentation or ask support. Most themes have a child theme file to download or instructions to do as theme developers likes.