-
AuthorPosts
-
April 12, 2016 at 9:35 pm #612149
Hello!
I had to change a line in /enfold/framework/php/class-form-generator.php code.
Now, how can I keep this edited code in my child theme so that it won’t be overwritten when theme is updated?
Thanks!
April 12, 2016 at 10:51 pm #612204Hey mmagnani!
Thanks for getting in touch with us!
Save the edited file separately in your child theme’s folder. After that you need the child theme to call that file by adding a line in your child theme’s functions.php. Here are instructions on how to do that https://codex.wordpress.org/Child_Themes#Referencing_.2F_Including_Files_in_Your_Child_Theme
Ensure you know the file path to where you put the edited file in the child theme directory. Let me know if you need further assistance.
Best regards,
JordanApril 13, 2016 at 1:38 pm #612717Thanks, Jordan
But this way the parent theme code would still be included. I mean, I need WordPress to use child theme code in lieu of parent theme code.
For example, I use the following code found in this forum for the language packs:
add_action('after_setup_theme', 'avia_child_lang_setup'); function avia_child_lang_setup() { remove_action('after_setup_theme', 'avia_lang_setup'); $lang = get_stylesheet_directory() . '/lang'; load_theme_textdomain('avia_framework', $lang); }
Shouldn’t I use something similar for the /enfold/framework/php/ path?
April 13, 2016 at 1:45 pm #612721Hey!
Please copy unmodified file and paste it inside enfold-child folder and apply your changes and find following line at the top
<?php if ( ! defined( 'AVIA_FW' ) ) exit( 'No direct script access allowed' );
and change it to
<?php
then add following line to functions.php file of your child theme
require( 'class-form-generator.php' );
Cheers!
YigitApril 13, 2016 at 2:28 pm #612765Thanks, Yigit
But had this error after editing functions.php.
PHP Fatal error: require(): Failed opening required ‘class-form-generator.php’ (include_path=’.:/opt/plesk/php/5.6/share/pear’) in /var/www/(…)/wp-content/themes/enfold-child/functions.php on line 8Any ideas?
April 13, 2016 at 2:36 pm #612768 -
AuthorPosts
- You must be logged in to reply to this topic.