Site icon Hip-Hop Website Design and Development

is_edit_mode() throws error in my youngster theme features.php

I’ve a baby theme for the OceanWP theme, and it really works nicely, however after I go to edit in Elementor, it hangs till I select protected mode.

I’ve narrowed the issue right down to a wp_enqueue_script in my features.php:

perform oceanwp_child_enqueue_parent_style() {
    //loading different kinds & scripts right here
    wp_enqueue_script("jquery-additional",'https://code.jquery.com/jquery-1.12.4.js', array('jquery'), '1.12.4',true); // If I remark out this line, Elementor editor works
}
add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style', 20 );

If I remark the wp_enqueue_script, then it goes into Elementor editor no downside.

What I wish to do is wrap a situation across the perform, or maybe simply the one line contained in the perform in order that if I am going into edit mode, it skips over that line.

All the things Ive learn says to do one thing like this:

if( ! ElementorPlugin::$instance->editor->is_edit_mode() ) 
{ 
    // not in edit mode, so I can load the script
    wp_enqueue_script("jquery-additional",'https://code.jquery.com/jquery-1.12.4.js', array('jquery'), '1.12.4',true);
}

Nevertheless, merely having ElementorPlugin::$instance->editor->is_edit_mode() in my features.php leads to a php error:

uncaught error: name to a member perform is_edit_mode()

If I take advantage of php’s get_defined_functions to checklist all obtainable outlined features, is_edit_mode will not be listed amongst them.

Can somebody inform me how one can correctly use the Elementor perform is_edit_mode(), or at the least one other method of detecting whether or not I am going into Elementor editor inside my youngster theme?