Source
- https://divilover.com/using-divi-template-hooks-to-add-global-footer-layout/
- https://www.elegantthemes.com/documentation/developers/hooks/divi-template-hooks/
The Divi theme contains several hooks where you can insert your own code. For example, it allows you to insert a Divi Library item at a hook position.
Use the following code to insert the library item:
- hws_promo_banner = the fuction, if you rename, do it at both places.
- 21380 = the library item ID (you see it in the url when you edit the item)
- et_before_main_content = the hook
// START insert banner between header and main content
function hws_promo_banner() {
echo do_shortcode('[et_pb_section global_module="21380"][/et_pb_section]');
}
add_action('et_before_main_content', 'hws_promo_banner');
// END insert banner between header and main contentCode language: PHP (php)
Divi template hooks
- et_after_main_content
- et_html_top_header
- et_html_slide_header
- et_html_logo_container
- et_header_top
- et_html_main_header
- et_before_main_content
- et_before_content