anually.
if ( empty( $this->locations_queue[ $location ] ) ) {
return false;
}
if ( is_singular() ) {
Utils::set_global_authordata();
}
/**
* Before location content printed.
*
* Fires before Elementor location was printed.
*
* The dynamic portion of the hook name, `$location`, refers to the location name.
*
* @since 2.0.0
*
* @param Locations_Manager $this An instance of locations manager.
*/
do_action( "elementor/theme/before_do_{$location}", $this );
while ( ! empty( $this->locations_queue[ $location ] ) ) {
$document_id = key( $this->locations_queue[ $location ] );
$document = Module::instance()->get_document( $document_id );
if ( ! $document || $this->is_printed( $location, $document_id ) ) {
$this->skip_doc_in_location( $location, $document_id );
continue;
}
// `$documents_by_conditions` can pe current post even if it's a draft.
if ( empty( $documents_by_conditions[ $document_id ] ) ) {
$post_status = get_post_status( $document_id );
if ( 'publish' !== $post_status ) {
$this->inspector_log( [
'location' => $location,
'document' => $document,
'description' => 'Added manually but skipped because is not Published',
] );
$this->skip_doc_in_location( $location, $document_id );
continue;
}
}
$this->inspector_log( [
'location' => $location,
'document' => $document,
'description' => isset( $documents_by_conditions[ $document_id ] ) ? 'Added By Condition' : 'Added Manually',
] );
$this->current_location = $location;
$document->print_content();
$this->did_locations[] = $this->current_location;
$this->current_location = null;
$this->set_is_printed( $location, $document_id );
}
/**
* After location content printed.
*
* Fires after Elementor location was printed.
*
* The dynamic portion of the hook name, `$location`, refers to the location name.
*
* @since 2.0.0
*
* @param Locations_Manager $this An instance of locations manager.
*/
do_action( "elementor/theme/after_do_{$location}", $this );
return true;
}
public function did_location( $location ) {
return in_array( $location, $this->did_locations, true );
}
public function get_current_location() {
return $this->current_location;
}
public function builder_wrapper( $content ) {
$post_id = get_the_ID();
if ( $post_id ) {
$document = Module::instance()->get_document( $post_id );
if ( $document ) {
$document_location = $document->get_location();
$location_settings = $this->get_location( $document_location );
// If is a `content` document or the theme is not support the document location (header/footer and etc.).
if ( $location_settings && ! $location_settings['edit_in_content'] ) {
$content = '
' . esc_html__( 'Content Area', 'elementor-pro' ) . '
';
}
}
}
return $content;
}
public function get_locations( $filter_args = [] ) {
$this->register_locations();
if ( is_string( $filter_args ) ) {
_deprecated_argument( __FUNCTION__, '2.4.0', 'Passing a location name is deprecated. Use `get_location` instead.' );
return $this->get_location( $filter_args );
}
return wp_list_filter( $this->locations, $filter_args );
}
public function get_location( $location ) {
$locations = $this->get_locations();
if ( isset( $locations[ $location ] ) ) {
$location_config = $locations[ $location ];
} else {
$location_config = [];
}
return $location_config;
}
public function get_doc_location( $post_id ) {
/** @var Theme_Document $document */
$document = Plugin::elementor()->documents->get( $post_id );
return $document->get_location();
}
public function get_core_locations() {
return $this->core_locations;
}
public function register_all_core_location() {
foreach ( $this->core_locations as $location => $settings ) {
$this->register_location( $location, $settings );
}
}
public function register_location( $location, $args = [] ) {
$args = wp_parse_args( $args, [
'label' => $location,
'multiple' => false,
'public' => true,
'edit_in_content' => true,
'hook' => 'elementor/theme/' . $location,
] );
$this->locations[ $location ] = $args;
add_action( $args['hook'], function() use ( $location, $args ) {
$did_location = Module::instance()->get_locations_manager()->do_location( $location );
if ( $did_location && ! empty( $args['remove_hooks'] ) ) {
foreach ( $args['remove_hooks'] as $item ) {
remove_action( $args['hook'], $item );
}
}
}, 5 );
}
public function register_core_location( $location, $args = [] ) {
if ( ! isset( $this->core_locations[ $location ] ) ) {
/* translators: %s: Location name. */
wp_die( esc_html( sprintf( esc_html__( 'Location \'%s\' is not a core location.', 'elementor-pro' ), $location ) ) );
}
$args = array_replace_recursive( $this->core_locations[ $location ], $args );
$this->register_location( $location, $args );
}
public function location_exits( $location = '', $check_match = false ) {
$location_exits = ! ! $this->get_location( $location );
if ( $location_exits && $check_match ) {
$location_exits = ! ! Module::instance()->get_conditions_manager()->get_documents_for_location( $location );
}
return $location_exits;
}
public function filter_add_location_meta_on_create_new_post( $meta ) {
if ( ! empty( $_GET['meta_location'] ) ) {
$meta[ Theme_Document::LOCATION_META_KEY ] = $_GET['meta_location'];
}
return $meta;
}
private function set_core_locations() {
$this->core_locations = [
'header' => [
'is_core' => true,
'public' => false,
'label' => esc_html__( 'Header', 'elementor-pro' ),
'edit_in_content' => false,
],
'footer' => [
'is_core' => true,
'public' => false,
'label' => esc_html__( 'Footer', 'elementor-pro' ),
'edit_in_content' => false,
],
'archive' => [
'is_core' => true,
'public' => false,
'overwrite' => true,
'label' => esc_html__( 'Archive', 'elementor-pro' ),
'edit_in_content' => true,
],
'single' => [
'is_core' => true,
'public' => false,
'label' => esc_html__( 'Single', 'elementor-pro' ),
'edit_in_content' => true,
],
];
}
public function inspector_log( $args ) {
$inspector_enabled = method_exists( Plugin::elementor()->inspector, 'is_enabled' ) && Plugin::elementor()->inspector->is_enabled();
if ( ! $inspector_enabled ) {
return;
}
$title = [];
$url = '';
if ( isset( $args['location'] ) ) {
$location_settings = $this->get_location( $args['location'] );
if ( $location_settings ) {
$args['location'] = $location_settings['label'];
}
$title[] = 'Location: ' . $args['location'];
}
if ( isset( $args['description'] ) ) {
$title[] = $args['description'];
}
if ( ! empty( $args['document'] ) ) {
$title[] = esc_html( $args['document']->get_post()->post_title );
$url = $args['document']->get_edit_url();
}
if ( isset( $args['template'] ) ) {
$title[] = Plugin::elementor()->inspector->parse_template_path( $args['template'] );
}
$title = implode( ' > ', $title );
Plugin::elementor()->inspector->add_log( 'Theme', $title, $url );
}
private function filter_page_template_locations( array $locations ) {
$templates_to_filter = [
PageTemplatesModule::TEMPLATE_CANVAS,
PageTemplatesModule::TEMPLATE_HEADER_FOOTER,
];
if ( ! in_array( $this->current_page_template, $templates_to_filter, true ) ) {
return $locations;
}
if ( PageTemplatesModule::TEMPLATE_CANVAS === $this->current_page_template ) {
$allowed_core = [];
} else {
$allowed_core = [ 'header', 'footer' ];
}
foreach ( $locations as $location => $settings ) {
if ( ! empty( $settings['is_core'] ) && ! in_array( $location, $allowed_core, true ) ) {
unset( $locations[ $location ] );
}
}
return $locations;
}
}
Fatal error: Uncaught Error: Class 'ElementorPro\Modules\ThemeBuilder\Classes\Locations_Manager' not found in /home/ocb/public_html/wp-content/plugins/elementor-pro/modules/theme-builder/module.php:413
Stack trace:
#0 /home/ocb/public_html/wp-content/plugins/elementor/core/base/module.php(85): ElementorPro\Modules\ThemeBuilder\Module->__construct()
#1 /home/ocb/public_html/wp-content/plugins/elementor-pro/core/modules-manager.php(84): Elementor\Core\Base\Module::instance()
#2 /home/ocb/public_html/wp-content/plugins/elementor-pro/plugin.php(327): ElementorPro\Core\Modules_Manager->__construct()
#3 /home/ocb/public_html/wp-includes/class-wp-hook.php(324): ElementorPro\Plugin->on_elementor_init('')
#4 /home/ocb/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#5 /home/ocb/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /home/ocb/public_html/wp-content/plugins/elementor/includes/plugin.php(647): do_action('elementor/init')
#7 /home/ocb/public_html/wp-includes/class-wp-ho in /home/ocb/public_html/wp-content/plugins/elementor-pro/modules/theme-builder/module.php on line 413