Can I include a folder from a parent theme to use a child theme?

I have a folder in the parent theme that overrides what a single plugin looks like. If I do not copy this folder to my child theme, the appearance of the child theme will be different from the parent.

Is it possible somehow, in the child theme functions.php file, to include this folder (make the child theme this folder). I searched everything but found nothing.

The only way to make a child theme look like a parent (which I can change) is to copy this folder to the child theme folder.

I tried using

$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 read that this could be due to a lack of permissions on the server.

+6
source share
2 answers

Copy the parent folder to your child folder.

0
source

If it were a style issue, good Wordpress practitioners said that styles should be added by enqueuing.

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

You should try to confirm if your topic really does this, and if your child theme does too.

If your theme overrides php template files, you simply copy this folder to your child theme, edit what you want, and delete the unedited files.

In any case, I recommend checking the topic documentation or contacting for support. Most themes have a file with child themes for download, or instructions that people who like themes like.

0
source

Source: https://habr.com/ru/post/979922/


All Articles