Archived topic
Parent them functions not found.
5 replies · Started by William on February 15, 2017
Greetings,
I have created a child theme to integrate some content within the parent theme files. I copied the header.php file from parent theme to child and added the Facebook tags within the <head>;
Unfortunately I get the following error when activating the child theme :
[15-Feb-2017 19:06:59 UTC] PHP Fatal error: Call to undefined function generate_body_schema() in /home/wlarchev/public_html/apartamentocovenas.co/wp-content/themes/generatepress-child/header.php on line 39
Why can't the parent theme functions be used in the child theme ?
Thanks,
They can. Have you verified that the function exists in the parent theme? Using the latest version?
Also, if you're only adding things like facebook tags, you're way better off inserting them into GP Hooks instead of creating a child theme and overwriting the entire header.php file.
Thanks Tom for your quick reply. In header.php, I am only adding the Facebook Pixel. I know I can use the hooks, but this will not resolve my issue.
I am using the latest Generate Press Version: 1.3.44.
Here is a comparison of both header.php files :
http://www.tiikoni.com/tis/view/?id=c5e968a
Error is :
[15-Feb-2017 19:24:01 UTC] PHP Fatal error: Call to undefined function generate_body_schema() in /home/wlarchev/public_html/apartamentocovenas.co/wp-content/themes/generatepress-child/header.php on line 35
The parent theme function generate_body_schema() cannot be called in the child theme... I do not understand why as I am using GeneratePress in another site without any problem.
Please advise :)
Just tried it myself with a child theme - no issues.
Can you try with the blank child theme available here?: https://docs.generatepress.com/article/using-child-theme/
As for your code, that should definitely go into the wp_head hook in GP Hooks. That way you won't miss out on any changes I make the header.php file in the future.
- I just removed all the files I had in the "generatepress-child" theme folder and replaced with the blank child theme provided in your documentation.
- I deactivated all plugins.
- I forced a reinstall of the parent theme to latest version.
- I disabled any server-side caching.
- I set define('WP_DEBUG', true);
This fixed the issue. Mysterious :)
Thanks for your support.
Glad you got it working :)