How to enable Elementor in our Themes (alternative PHP codes)

elementor active 2

For users who need Elementor to customize pages or use custom templates, the following updated custom codes enables the compatibility with our Bootstrap themes avoiding other bugs like Elementor not changing colors or properties on his own widgets. In the example, enables the custom header and footer templates in our Flux Theme.

The recommendation is go to Appearance – Themes and enable the Child Theme, then “Theme File Editor” and edit the functions.php file of the Child Theme. Add this custom code and save it.

function theme_prefix_register_elementor_locations( $elementor_theme_manager ) {

	$elementor_theme_manager->register_all_core_location();

}
add_action( 'elementor/theme/register_locations', 'theme_prefix_register_elementor_locations' );

Then, on the child theme folder, create:

a header.php with this code

<!doctype html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="http://gmpg.org/xfn/11">
	<?php wp_head(); ?>
</head>

<body <?php body_class('bg'); fluxwp_fade(); post_class(); ?>>	

<?php
// Elementor `header` location
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'header' ) ) {
	get_template_part( 'template-parts/header' );
} ?>

<?php if ( is_product() AND get_field('background') ) { ?>
<!-- extra background class for woo single products -->	
<div class="flux-background-overlay"></div>
<?php } ?>

<main class="elementor-cont-custom-width">

<div class="container-general">

a footer.php with this code

</div>

</main>

<?php
// Elementor `footer` location
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'footer' ) ) {
	get_template_part( 'template-parts/footer' );
}

wp_footer();
?>

</body>
</html>

Then, you can create custom Header and Footer templates on Elementor and apply to “Entire site” condition.

How to enable Elementor in our Themes (alternative PHP codes)
Screenshot taken from example of a brazilian user of Flux Theme with Elementor (localhost test)

In other cases you can request our assistance, we are glad to help you on any question.