Support » Themes and Templates » Creating Child Theme Fatal Error

  • URL->
    Theme-> cover-wp

    I tried to create a child theme using instructions located here..

    Now I get this error..

    Fatal error: Cannot redeclare header_style() (previously declared in /home/content/06/5981006/html/ryloree/wp-content/themes/cover-wp child/functions.php:32) in /home/content/06/5981006/html/ryloree/wp-content/themes/cover-wp/functions.php on line 47

    please help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ok I started over and now I have my child theme installed and all I have in my child theme folder is a style.css file with this in it..

    Theme Name:     cover-wp-child
    Theme URI:      http: //
    Description:    Child theme for the cover-wp theme
    Author:         Nick Houdek
    Template:       cover-wp
    Version:        0.1.0
    @import url("../cover-wp/style.css");

    I am getting this error..

    Warning: require_once(/home/content/06/5981006/html/ryloree/wp-content/themes/cover-wp child/theme-options.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/06/5981006/html/ryloree/wp-content/themes/cover-wp/functions.php on line 3

    Fatal error: require_once() [function.require]: Failed opening required ‘/home/content/06/5981006/html/ryloree/wp-content/themes/cover-wp child/theme-options.php’ (include_path=’.:/usr/local/php5/lib/php’) in /home/content/06/5981006/html/ryloree/wp-content/themes/cover-wp/functions.php on line 3

    I didn’t find out why my child theme was not working but I was able to load a new theme.

    This is how just in case someone stumbles upon this conversation I seem to be having with myself.

    I tried to create a child theme to the cover-wp theme and failed. When I typed my url in I received a fatal error. Then I tried to go to me admin panel to switch the theme back to the parent

    I was still recieving an error. I finally had to delete both the child and parent theme folders from my server in order to get to my admin panel to reload the theme.
    Hope this helps someone

    I would still like to know what I did wrong in creating my child theme, if someone could please let me know.

    Chip Bennett


    Theme Review Admin

    Okay, you have a few of issues:

    1. Don’t create a functions.php in your Child Theme, unless you actually intend to define custom functions.

    2. If you do create a functions.php, you cannot reuse function names from the Parent Theme, or else you’ll get errors such as Cannot redeclare header_style(). (This error is telling you that the function named header_style() is already declared – i.e. is already defined somewhere else.)

    3. If you create custom functions, always prefix the function names uniquely (usually, using the theme-slug), in order to prevent function-name conflicts.

    4. You may need to modify your Parent Theme, as it does not appear to be configured properly for Child Theming. For example, in functions.php, this line is causing one of your problems:

    require_once ( get_stylesheet_directory() . '/theme-options.php' );

    The get_stylesheet_directory() should instead be get_template_directory().

    The problem is that, when using a Child Theme, the Stylesheet directory refers to the Child Theme, and the Template directory refers to the Parent Theme – so what’s happening here is that the Parent Theme’s functions.php file is telling WordPress to look in the Child Theme (i.e. the stylesheet directory) for the theme-options.php file, instead of in the Parent Theme (i.e. the template directory), where it should be looking.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating Child Theme Fatal Error’ is closed to new replies.