Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Elementor Locations integration for GeneratePress
<?php
/**
* Elementor Pro integration.
*
* @package GeneratePress
* @subpackage Integration
*/
defined( 'ABSPATH' ) || die( "Can't access directly" );
/**
* Register Elementor locations.
*
* @param object $elementor_theme_manager The elementor theme manager.
*/
function generate_elementor_locations( $elementor_theme_manager ) {
// Header.
$elementor_theme_manager->register_location(
'header',
[
'hook' => 'generate_header',
'remove_hooks' => ['generate_do_header'],
]
);
$elementor_theme_manager->register_location(
'before-header',
[
'label' => __( 'Before Header', 'generatepress' ),
'multiple' => true,
'hook' => 'generate_before_header',
]
);
$elementor_theme_manager->register_location(
'after-header',
[
'label' => __( 'After Header', 'generatepress' ),
'multiple' => true,
'hook' => 'generate_after_header',
]
);
// Footer.
$elementor_theme_manager->register_location(
'before-footer',
[
'label' => __( 'Before Footer', 'generatepress' ),
'multiple' => true,
'hook' => 'generate_before_footer',
]
);
$elementor_theme_manager->register_location(
'after-footer',
[
'label' => __( 'After Footer', 'generatepress' ),
'multiple' => true,
'hook' => 'generate_after_footer',
]
);
// Article.
$elementor_theme_manager->register_location(
'before-post',
[
'label' => __( 'Before Content', 'generatepress' ),
'multiple' => true,
'hook' => 'generate_before_content',
]
);
$elementor_theme_manager->register_location(
'after-post',
[
'label' => __( 'After Content', 'generatepress' ),
'multiple' => true,
'hook' => 'generate_after_content',
]
);
}
add_action( 'elementor/theme/register_locations', 'generate_elementor_locations' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment