Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.7.0: hello_elementor_body_open) no longer working #278

Closed
vendojo opened this issue Mar 27, 2023 · 6 comments
Closed

2.7.0: hello_elementor_body_open) no longer working #278

vendojo opened this issue Mar 27, 2023 · 6 comments

Comments

@vendojo
Copy link

vendojo commented Mar 27, 2023

Hi there, just got a 'Fatal error: Uncaught Error: Call to undefined function hello_elementor_body_open)' due to the most recent update. What should I do?

@PaulHHM
Copy link

PaulHHM commented Mar 27, 2023

Same. My solution was to download the 2.6 version (https://github.com/elementor/hello-theme/releases/tag/v2.6.0) and upload it to the wp-admin and then turn off automatic updates for this theme.

@rami-elementor
Copy link
Member

We removed hello_elementor_body_open() function in #246

You no longer need to use this function. You can use the native WordPress wp_body_open() function.

I'm trying to understand where/how do you use hello_elementor_body_open() function? are you use this in a child theme? or custom code?

@PaulHHM
Copy link

PaulHHM commented Mar 27, 2023

For me, it was an issue with the hello-child-theme using a child version of the header.php from https://github.com/elementor/hello-theme/blob/v2.6.0/header.php that included the hello_elementor_body_open function call. Because that function no longer exists, it caused sites to have issues - would have been better to have a deprecation notice or something instead of removing a function that has been in the theme for 4+ years.

@rami-elementor
Copy link
Member

rami-elementor commented Mar 27, 2023

Hi @PaulHHM

You are correct, we had to communicate the change better.

From what I understand, sites using child themes, with custom header.php file has the following markup:

<?php
/**
 * The template for displaying the header
 *
 * This is the template that displays all of the <head> section, opens the <body> tag and adds the site's header.
 *
 * @package HelloElementor
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<?php $viewport_content = apply_filters( 'hello_elementor_viewport_content', 'width=device-width, initial-scale=1' ); ?>
	<meta name="viewport" content="<?php echo esc_attr( $viewport_content ); ?>">
	<link rel="profile" href="https://gmpg.org/xfn/11">
	<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>

<?php hello_elementor_body_open(); ?>

<a class="skip-link screen-reader-text" href="#content">
	<?php esc_html_e( 'Skip to content', 'hello-elementor' ); ?></a>

<?php
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'header' ) ) {
	if ( did_action( 'elementor/loaded' ) && hello_header_footer_experiment_active() ) {
		get_template_part( 'template-parts/dynamic-header' );
	} else {
		get_template_part( 'template-parts/header' );
	}
}

The fix is simple, all you need to do is replace hello_elementor_body_open() with wp_body_open().


UPDATE: We plan to release a patch version (2.7.1) that fixes this issue. This patch won't require you to update your child theme.

@vendojo
Copy link
Author

vendojo commented Mar 27, 2023

Awesome, thanks for your quick help!

@arielk
Copy link
Member

arielk commented Mar 27, 2023

https://github.com/elementor/hello-theme/releases/tag/v2.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants