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.)
In that way, the functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme.
Say that you want to add a PHP function to your theme. The fastest way would be to open its functions.php file and put the function there. But that’s not smart: The next time your theme is updated, your function will disappear. But there is an alternative way which is the smart way: you can create a child theme, add a functions.php file in it, and add your function to that file.
The function will do the exact same job from there too, with the advantage that it will not be affected by future updates of the parent theme. Do not copy the full content of functions.php of the parent theme into functions.php in the child theme.
Source: https://codex.wordpress.org/Child_Themes
Example Functions
You can add own functions which
- are called at designated points of the theme (action hooks)
See Using Theme Hooks - manipulate data like query arguments from the parent (filter hooks)
See Interacting with Theme Filters - overwrite pluggable functions from the parent theme
See Rewriting Pluggable Functions
en
de