• Resolved aramirez1985

    (@aramirez1985)


    How do you edit a functions file after a child theme has been made? I’m very new to child themes and still haven’t got it all figured out am I able to edit a functions file once a child theme was created? I read you can’t just paste a parents functions file 🙂 Again apologies to he newbieness lol

Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael

    (@mh-themes)

    Hi aramirez1985,

    thanks for using MH Magazine lite.

    You can create a functions.php file within your child theme (if not done already) where you can add your custom PHP functions. In case of overriding functions from the parent theme within your child theme, there are some things to consider because some functions are pluggable and others can be handled by using action hooks. Here is a tutorial that explains the basics pretty well.

    Thread Starter aramirez1985

    (@aramirez1985)

    Whats the difference between pasting the parent theme’s functions and plugging functions in manually? wouldn’t it be the same thing? Also, what about editing current functions that already exist in the functions? do i just add them to the child theme?

    Michael

    (@mh-themes)

    Please have a look at the tutorial which has been linked above because all of this is already explained there.

    Whats the difference between pasting the parent theme’s functions and plugging functions in manually?

    You can only copy & paste plugabble functions into your child theme. If you do this with functions that aren’t pluggable it usually will result in errors.

    Also, what about editing current functions that already exist in the functions?

    You shouldn’t modify functions within the parent theme as these changes will be lost after theme updates. That’s why you should make use of a child theme and code your own functions there.

    do i just add them to the child theme?

    If the function is pluggable, you can copy & paste it into your child theme and modify it as you like. For other functions you would need to make use of action hooks or filters (dependent on the functions) to get rid of the old functionality and then you can add your own functionality as you like.

    This forum is for theme related support, we can’t provide free support for WordPress custom development here. In case you have more questions about WordPress custom development, you could try the WordPress forums instead.

    Thread Starter aramirez1985

    (@aramirez1985)

    Oh I thought mh-magazine created child themes hence me asking you guys about child themes 🙂 I kid I kid. Thanks for the extended help on this matter

    Michael

    (@mh-themes)

    You’re very welcome. No, child themes are part of WordPress itself, we haven’t invented that. 🙂

    Here you can find more information: https://codex.ww.wp.xz.cn/Child_Themes

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Child themes’ is closed to new replies.