Skip to content

Instantly share code, notes, and snippets.

@avblink
Last active April 1, 2025 09:17
Show Gist options
  • Save avblink/dd314179e4a50ecc71c4f68809428af8 to your computer and use it in GitHub Desktop.
Save avblink/dd314179e4a50ecc71c4f68809428af8 to your computer and use it in GitHub Desktop.

Elementor requires get_header() and get_footer() to load its scripts and templates.

Add this to functions.php

 use ElementorPro\Modules\ThemeBuilder\Module;

function render_elementor_header() {
    if ( function_exists('elementor_theme_do_location') ) {
        elementor_theme_do_location('header');
    }
}

function render_elementor_footer() {
    if ( function_exists('elementor_theme_do_location') ) {
        elementor_theme_do_location('footer');
    }
}

And this inside base.twig file of your Timber theme:

<body class="{{body_class}}" data-template="base.twig">
	{{ function('wp_body_open') }}
	<a class="skip-link screen-reader-text" href="#content">{{ _e( 'Skip to content') }}</a>
	{{ function('render_elementor_header') }}
	<header class="header" >
.
.
.

{% block footer %}
	{{ function('render_elementor_footer') }}
	{{ function('wp_footer') }}
{% endblock %}

This should get your Elementor Headers and Footers working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment