WordPress newbie- Query regarding child themes and parent themes->WP admin options

I am creating a child theme for the first time.

I have created style.css (and imported parent theme’s style.css in it) and also some new files+ additional functions in functions.php.

Now, I have copied index.php from parent theme to child theme

However still some of the parent theme’s admin options are not being picked up in child theme–> specifically I get a fatal PHP error that a function is not recognised when I load index.php (after setting child theme as the theme to be used by WP).

(1) Do I even have to copy index.php from parent-> child (2) If I want basically parent’s index.php to be loaded then do I leave child theme’s index.php blank? Or do I import the parent’s index.php (in the child theme’s index.php) (3) There are some admin options added to child theme(in addition to those in parent theme)– now do I set the admin options (of parent theme) by configuring the parent theme in WP admin? (4) Is it possible to show the admin options pertaining to the parent theme within the child theme’s admin options? So that I need not configure the parent theme’s options separately from those in the child theme? How do I do this? Also do you recommend this approach(point 4) or the previous approach(separately configuring parent theme’s admin options within the parent theme itself–> point 3)?

  • PC
    • WPMU DEV Initiate

    Hello Arvind,

    Thanks for posting on the forums.

    Creating a child theme requires some things to be considered.

    It’s a very simple process as discussed here : https://premium.wpmudev.org/blog/how-to-create-a-wordpress-child-theme-in-3-steps/

    It will require some templating knowledge too. http://codex.wordpress.org/Templates

    As discussed here : http://codex.wordpress.org/Child_Themes

    Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

    So any extra functions you want in your theme, need to go to the child themes functions.php

    So you will need to read more regarding the same in order to understand how it works.

    You do not need to copy the parents index.php or create separate admin functions in child theme. It will automatically inherit it from the parent theme.

    The only reason child themes are created is that you do not have to worry about losing the changes in case the parent theme updates.

    I hope that helps. Please feel free to ask if you have more questions on the same.

    Cheers

    PC

    Sales &Support

  • Arvind
    • Site Builder, Child of Zeus

    Hi PC

    (1) OK , I dont have to copy index.php from parent to child?

    (2) I want all admin options of parent, plus some options for the child theme only. How do I do this? Do I simply add the admin options for child theme separately in files with names that are not there in parent–> so that parent’s admin options will be inherited as usual while the new files added to child will take care of the child theme’s options?

    (3) With ref to point 2, do I have to set the parent theme’s options by configuring the parent theme in WP admin, and then set child theme’s options by configuring the child theme in WP admin? Or can I do both parent+child theme’s options together from the child theme itself in WP admin?

    Thanks,

    Arvind.

  • Arvind
    • Site Builder, Child of Zeus

    Hi again

    I just deleted the index.php in child and this is the error I am getting –

    “The following themes are installed but incomplete. Themes must have a stylesheet and a template.”

    Take a look at the screenshot attached.

    Please let me know how to solve this problem?

    Thanks,

    Arvind.

  • PC
    • WPMU DEV Initiate

    Hiya,

    thanks for posting back.

    Can you follow the steps in this thread to see if that helps fix the issue ? http://wordpress.org/support/topic/template-is-missing-child-theme

    (1) OK , I dont have to copy index.php from parent to child?

    (2) I want all admin options of parent, plus some options for the child theme only. How do I do this? Do I simply add the admin options for child theme separately in files with names that are not there in parent–> so that parent’s admin options will be inherited as usual while the new files added to child will take care of the child theme’s options?

    (3) With ref to point 2, do I have to set the parent theme’s options by configuring the parent theme in WP admin, and then set child theme’s options by configuring the child theme in WP admin? Or can I do both parent+child theme’s options together from the child theme itself in WP admin?

    This will answer most of your questions : http://wp.smashingmagazine.com/2013/03/13/guide-wordpress-theme-options/

    The theme options are inherited from the parent theme. If you want to add more you can add them to functions.php in child theme.

    Here is a plugin you can use to create a one click child theme : http://www.ostraining.com/blog/wordpress/ne-click-child-theme/

    I hope that helps. Please feel free to ask if you have more questions on the same.

    Cheers

    PC

    Sales &Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.