Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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!

    #612204

    Hey 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,
    Jordan

    #612717

    Thanks, 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?

    #612721

    Hey!

    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!
    Yigit

    #612765

    Thanks, 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 8

    Any ideas?

    #612768

    Hi!

    Have you moved the file to your child theme? If you need further assistance from us, please post FTP and temporary admin logins here privately.

    Best regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.