Using Divi Template Hooks to Add Global Footer Layout

Divi Freebies, Quick Divi Tips | 81 comments

Oftentimes, when using the Divi theme, we find ourselves with the need to build our website footer using the Divi Builder rather than standard WordPress widgets. At first, you try playing with the global sections – you place your global section on each page and post manually. That approach works well to some extent, but if you’re using a blog, you might not want to use the Divi Builder on each post. Not to mention the pages like archives, blog categories, search results – all of these can’t be edited with the Divi Builder as of yet.

Divi Theme Builder

Elegant Themes have already announced they’re working on something they called the “Theme Builder”, which will allow us to use the Divi Builder to design every pixel of our website. There is no ETA on this feature yet, all we know is that it’s on the roadmap. So until then – there’s a pretty simple method to display any Divi layout as a global footer – without editing the footer.php file, so let’s dive in!

First – the Footer Layout

It doesn’t really matter what method you’ll use to create your footer layout. You can use one of Divi’s pre-made layouts, create one from scratch using the Builder, or (if you’re our subscriber) you can download the one I made for this tutorial:

All that matters is that your layout is saved in the Divi Library.

Free Resources for Divi Lovers

Join our newsletter to get the good stuff!

We’ll provide you with updates on new tutorials, webdesign assets and special offers. Get top quality Divi goodies straight into your inbox! Read our Privacy Policy to learn how we manage and protect your submitted information.

Sign up to download

Get access to this layout and all the free resources made exclusively for our subscribers!

Already subscribed?

Fill the signup form and if you’re on the list it’ll get you straight to the download page!

Can’t see the form? Click here

The Divi Library & Layout ID

For this method to work, we first need to know the ID of the layout we want to use. If you navigate to the Divi Library and choose to edit your layout, you’ll be able to see the ID in the browser address bar. You should see something like this:

787 is the layout ID in this example.

Divi Template Hooks

Divi version 3.2 (the so-called Developer Edition ;-)) has introduced new template Hooks (Filter and Actions). You can read all about it in Elegant Themes Documentation page, but in this tutorial we will be focusing on one hook in particular.

The et_after_main_content is an action hook, and – just like any WP action hook – it is triggered at a specific time when WordPress is running and lets us take an action. We can read in the Divi documentation that it fires after the main content, before the footer is output. And that is a great time to insert our footer, right?

Add function to functions.php

We need to add a function to our child theme’s functions.php file. Remember not to edit the Divi theme directly as any changes made in the Divi template files will be lost with the next update. And if you’re using a premium Divi Child Theme and you don’t want to edit its files either – you can create a simple plugin and include this function inside.

This is the code we’ll need:

function dl_custom_footer() {
	echo do_shortcode('[et_pb_section global_module="787"][/et_pb_section]');
add_action('et_after_main_content', 'dl_custom_footer');

That’s it

Just remember to change 787 to your own layout ID and you’re all set having a truly global footer.

In my next post, I’ll show you how to apply conditional logic to your function in order to display layouts on specific pages using WordPress conditional tags, so make sure you don’t miss that one!

Feeling generous?

If you like my tutorials and want to see more free resources like this, please consider making a donation.

Personal Info

Donation Total: €5.00

Have you seen our Divi Child Themes?

We offer a great selection of high-quality designs to speed up your work. Feel free to use a coupon code IREADBLOG at the checkout to get a 10% discount!


  1. webabzar

    thanks ania, very helpful article it save my time

    • Ania Romańska

      Using shortcodes is different than using Template Hooks – the plugin seems like a solid solution for what you need, and it’s very lightweight.

  2. Drew

    Can this be applied to links in Mega Menu? 🙂

  3. Best Paintball Gun

    Will this work for Extra theme too?
    I followed the same steps in Extra theme but it is not showing the new footer.
    Can you please help me?
    This is the site:

    • Ania Romańska

      No, I’m afraid there is no template hooks in the Extra theme (at least there were no last time I checked, you should see the theme footer.php)

  4. Shelley Tomich

    Hi! I am working on a site for a client and have used the hook to insert a footer (the whole thing work in progress, don’t judge the design). But there is a white space below the wood grain and the bottom bar. I actually don’t want either.
    I can hide the bottom bar with
    #main-footer {display: none;}

    but white space is still there. Any ideas?

  5. Tomas

    Hi Ania, this code doesn’t work with latest version 3.26.3. I tried get this code in child and normal theme, but nothing happens. Can you help me please? Thank you!

  6. martinez paul


    There is an issue with this trick, Monarch social network appear after the footer …
    have you a solution for that ?

    Thank you

  7. Charlie Everest

    This is great! And I will definitely give it a try

  8. Johan van Es


    I want to show one layout over the entire site on a certain day of the week. How can I do that?

    • Ania Romańska

      You would need to use a cron job for that or some custom PHP function. There is also a plugin called Divi Display Logic, which may have this option. I’m sorry, but I can’t help you in more details.

  9. Amy S Chaplin

    I was trying to display two sections using this:

    Only the first shows–can you please explain what I’m going wrong?
    Thank you!

  10. Jason L

    Howdy! This is great!

    Would one need to disable the existing footer and then add this code to the functions file?

    Thank you!

    • Ania Romańska

      You can use both – the “injected” footer design will be displayed just before the standard Divi footer.

  11. Shanora

    I know this has been out for awhile, but I’m just now getting around to it… so much easier than I expected! Thanks for the info.

  12. Jaroslava Vagner Svensson

    Hi Ania, would you be able to help with a code that hides the hook section when going into the visual builder? I have a section that is in the header, but it takes up so much of the screen when my client goes in to edit in the front end? I hope that makes any sense. Basically, hide a section in visual builder in the front end. 🙂 Thank you for all your super content!

    • Ania Romańska

      Hi Jaroslava,
      The body element gets a CSS class of et-fb when the Divi Biulder is enabled, so you can use this (and your injected section ID) to hide that section, using custom CSS in the Theme Options or in the stylesheet.

  13. Vassilis

    Hi Ania and thank you for your usefull tips, just a question.. did you notice that the injected layouts with do_shortcode are not correctly rendered into the visual builder?This happens through hooks or even editing the php of the page.
    Is there a workaround to this? I searched a lot without finding a solution, is like when the visual builder is enabled, the sections and rows of the injected layouts are counted in a wrong way and it can’t retrieve the right classes, so sections appears unstyled.
    many thanks

    • Ania Romańska

      Yes, I don’t have the solution for that, but I wouldn’t worry about it either. It’s how how the front page of your site looks is important, not the VB 😉

  14. Andreas

    Many thanks for this useful method, Ania.
    I have the issue that I loose all my section styling (padding between the columns, bullet points – no CSS-Code changed!).
    Only on the page on which I created the global section the styling appears as it should be.
    Any Idea?
    Many thanks!

    • Ania Romańska

      I wouldn’t use global section here, they tend to behave very weirdly sometimes. You will still be able to edit it in one place via Divi Library, there is no need to use the global setting here.

    • Rodeck

      I have learned something new – thanks for that.
      Of course the hook replaces the global feature, all changes made via the library are hooked to each site.
      Without global settings the footer on the homepage is different from the hooked footer on the other pages (padding, bullet points). Even if i leave the footer section as as additional section on the homepage and hook the section again to the homepage there is the difference in styling as well?

      • Ania Romańska

        Are you using custom CSS to style the footer? It’s hard to guess what could be wrong here without seeing the page..

  15. Gegli

    thanks Ania . it was useful

  16. btdong

    thank you for that tutorial.

    How about if i want to insert the section just right after my blog content (before the comment box) ?

  17. Kotryna

    Thank you for your clear and useful tutorial!
    I have the same problem as someone mentioned – the Background is not rendered. The background in the footer in post pages is white, but it should be grey (I try to add different footers in different pages).
    Maybe someone else had this problem too and know how to solve the Background issue?

  18. Gegli

    thanks for help about that

  19. Gk

    Hi Ania, I used the same tips to add the layout above the footer. but somehow the background colour are not rendering. Any suggestion?
    Please advise how can can I send PM with link

  20. Dante

    Can this be hidden on pages that we want to display ‘Blank’ templates on? I am using this on a Woocommerce store and would like to remove the header and footer entirely from the checkout page, however the section using the hook is sticking around.

    • Ania Romańska

      Yes, it is possible – check your checkout page source to see what classes are added to the body element and also add a custom CSS class or CSS ID to your section. Then use custom CSS to hide your section, something like

      body.checkout-page #your-section-id {display:none;}
  21. Gina Preston

    Unfortunately this is not working for me.

    • Ania Romańska

      This is most likely due to outdated child theme you’re using, which doesn’t include the Divi template hooks. Make sure the header.php and footer.php in your child theme are up to date with the latest Divi version of those files.

  22. frank

    Can i use this code on Divi extra theme?

    • Ania Romańska

      No, I don’t think Extra theme has it’s own template hooks. The Divi ones won’t work, and there is no documentation on ET website if there are any others. You’d need to check the theme files to see if you can find any.

  23. Julia

    Hi Ania,

    I love this solution and have used it successfully throughout the site.

    However, I have just noticed that if I add a new item to the Divi Library the footer then defaults to that item (despite the fact that the page id is different to what I have put in the code in the functions.php file).

    I’m not sure if you can shed any light on this but would greatly appreciate if you can suggest anything? I am also using your Divi Toolbox plugin but I cannot find anything there that is conflicting with this.

    • Ania Romańska