Support » Fixing WordPress » having trouble with child theme creation

  • Resolved edwinx



    I am trying to create a child theme by following the instructions in this link:

    but I am getting this error:

    Fatal error: Cannot redeclare theme_enqueue_styles() (previously declared in C:\xampp\apps\wordpress\htdocs\wp-content\themes\iknowledge-child\functions.php:15) in C:\xampp\apps\wordpress\htdocs\wp-content\themes\iknowledge-child\functions.php on line 29

    What should I be looking for? or why is this erroring-out?


Viewing 4 replies - 1 through 4 (of 4 total)
  • I Googled around for solutions to your error message and came up with this advise, “Make sure your child functions.php is not a 100% copy of the parent’s functions file.” I’ll keep Googling! 🙂

    when I was first testing, I made a copy of the theme’s functions.php file then I deleted everything in that file and it seems to work.

    I commented out:

    function theme_enqueue_styles() {
        $parent_style = 'parent-style';
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style )
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

    Do I need that section of code?

    You *shouldn’t* need to add that section in the first place. I’ve never needed to in any child theme I’ve created.

    In either case, the “theme_enqueue_styles” function must have already been declared in the parent theme, so definitely no need to add it here.

    Most child themes are able to import the parent theme data without that snippet of code anyway.

    cool, thanks so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘having trouble with child theme creation’ is closed to new replies.