Support » Fixing WordPress » How do I use customized code from parent theme in my child theme?

  • Hi,

    I am new to WordPress but I’m eagerly learning my way around. I’m currently working on my company’s website and we purchased a theme from Gorilla Themes. While customizing some of the features that came with the theme, I have thus far modified the following files:

    1. /functions/meta-boxes-code.php
    2. /functions/menu-and-settings-page.php
    3. /includes/find-cars.php

    They suggested that I do this in a Child theme and with their help I was able to setup a child theme, create a style.css file with an import statement to the parent style.css file, and activate it. However, I’m concerned now that should the parent theme get updated all the customization I’ve made in the files above will be lost. I’ve already tried copying the /functions and /includes folders into my child theme folder, but that didn’t work – WordPress simply loaded from the parent.

    So my question is, how do I use the functionality of the customized files from my child theme?

Viewing 3 replies - 1 through 3 (of 3 total)
  • catacaustic

    (@catacaustic)

    very awesome

    I think that what you’ve done is going to cause problems. Child themes are more about making the layout different, not the functionality.

    You can change the functionality in acoupel of differnt ways, but not all are guaranteed to work…

    • If the parent theme has actions or filters where they are needed. If those aren’t there, then obviously you can’t use them.
    • You can set up your own function file/files and re-create the functions from the parent theme and make your modifications. The downside to this is that the parent theme must have every function wrapped in a call like if( function_exists ('function_name')) { so that the functions isn’t defined twice which would cause a fatal error.

    If neither of these work I’d suggest going back to your themes vendoer or author and asking them for assistance.

    Oh no, not what I wanted to hear. But thanks for the advice anyhow. I did check and some of the theme’s functions do have that wrapper, but not all.

    As you’ve suggested, I’ll go back to Gorilla Themes and wait for their answer, since they suggested I could do it via a child theme.

    I really appreciate the help, thanks.

    The most hassle free way would be if they provided hooks for you to change the parent theme look and feel.

    But depending on the templates, this may not be possible and you’re left with comparing each theme update with your modifications…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I use customized code from parent theme in my child theme?’ is closed to new replies.