• Hi,

    I am trying to modify my child theme. Right now the function.php has got the following code:

    require_once( get_template_directory() . '/admin/main/options/02.homepage.php' );

    I have edited the 02.homepage.php and saved it under the same directory structure in my child theme. If I change the function.php code in the parent theme to

    require_once( get_template_directory() . '/../child_theme/admin/main/options/02.homepage.php' );

    it works fine. But if I write the same code in my child theme function.php it doesn’t work. If I write get_stylesheet_directory the site goes blank.

    I read somewhere that if the code doesn’t have

    if ( ! function_exists…

    before, then you can’t overwrite the parent function in your child theme.

    Any ideas? Appriciate the help!

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter raggie

    (@raggie)

    I got it working with my footer, when i deleted the code from the “normal” footer.php in my child theme. In the “nomarl” header.php i found the following row:

    <?php thinkup_input_homepagesection(); ?>

    I tried to change it to e.g. thinkup_input_homepagesection1 and also change it in the other php file where the code is:

    function thinkup_input_homepagesection() {

    But I get “Fatal error: Call to undefined function thinkup_input_homepagesection1()” so obviously this is not the right way to do it?

    Appreciate someone can help me as I am not a IT personnel I have created a webpage using customizr theme and trying to activate my child theme then I get this error message
    Fatal error: Cannot redeclare my_custom_credits() (previously declared in /var/www/vhosts/uniontec.com.sg/httpdocs/Course/wordpress_b/wp-content/themes/customizr-child/functions.php:5) in /var/www/vhosts/uniontec.com.sg/httpdocs/Course/wordpress_b/wp-content/themes/customizr/functions.php on line 6

    Now I am totally log out from my webpage…can someone be kind enough to assist me…..many thanks…

Viewing 2 replies - 16 through 17 (of 17 total)

The topic ‘problem with "require_once" in child theme’ is closed to new replies.