Override Include in Functions
-
I’m trying to override my /includes/custom-style.php in a child theme of a prefab theme I purchased.
According to WP documentation, child themes will only override in the root level of the directory. Since this change is a subdirectory, the changes do not override by default. I then tried to manually include it, but I think I’m having conflict issues.
I’ve created a unique function.php file that calls the custom-style.php
<?php define(‘child_template_directory’, dirname( get_bloginfo(‘stylesheet_url’)). ‘/includes’ ); include_once child_template_directory.’/custom-style.php’; ?>
I get this error message:
Warning: include_once() [function.include-once]: https:// wrapper is disabled in the server configuration by allow_url_include=0 in F:\Users\MyDirectory\Documents\Websites\www.mysite.dev\wp\wp-content\themes\jarvis_wp-child\functions.php on line 5
Warning: include_once(https://www.mysite.dev/wp/wp-content/themes/jarvis_wp-child/includes/custom-style.php) [function.include-once]: failed to open stream: no suitable wrapper could be found in F:\Users\MyDirectory\Documents\Websites\www.mysite.dev\wp\wp-content\themes\jarvis_wp-child\functions.php on line 5
Warning: include_once() [function.include]: Failed opening ‘https://www.mysite.dev/wp/wp-content/themes/jarvis_wp-child/includes/custom-style.php’ for inclusion (include_path=’.;c:\xampplite\php\PEAR’) in F:\Users\MyDirectory\Documents\Websites\www.mysite.dev\wp\wp-content\themes\jarvis_wp-child\functions.php on line 5
In the original functions.php there is a line:
include_once RNR_FUNCTIONS.’/custom-style.php’;
It is not included within a function.
I assume this is still called after and will still execute since the functions.php only appends the parent functions.php (vs. an override on every other file). How do I override this without touching the parent theme?
My PHP skills are intermediate. Thanks!
- The topic ‘Override Include in Functions’ is closed to new replies.