So, let’s assume you want to add a banner ad before the entire header. There are three ways to do that:
1. Edit the parent theme’s code and add the code in the header file
2. Copy the header file into the child theme and modify the code in that file
3. Use an action in a child theme’s functions.php
With the #1 and #2 above, there is a high possibility that the edit would be lost during an update. By using an action, you don’t edit or overwrite the core code which is why, your code will rarely need to be changed.
To add a banner ad before the entire header, we need to use the “avada_before_header_wrapper” action in the functions.php of the child theme. Following is an example code:
Filters are similar to the actions but instead of ‘hooking’ into the code, you are simply changing the final output. You can read more about the difference difference between actions and filters from the beginner’s guide.