get_var( "SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE `meta_key` = '_elementor_edit_mode' LIMIT 1;" ); if ( $has_elementor_page ) { return; } wp_safe_redirect( admin_url( 'admin.php?page=elementor-getting-started' ) ); exit; } /** * Enqueue admin scripts. * * Registers all the admin scripts and enqueues them. * * Fired by `admin_enqueue_scripts` action. * * @since 1.0.0 * @access public */ public function enqueue_scripts() { wp_register_script( 'elementor-admin', $this->get_js_assets_url( 'admin' ), [ 'elementor-common', ], ELEMENTOR_VERSION, true ); wp_enqueue_script( 'elementor-admin' ); $this->print_config(); } /** * Enqueue admin styles. * * Registers all the admin styles and enqueues them. * * Fired by `admin_enqueue_scripts` action. * * @since 1.0.0 * @access public */ public function enqueue_styles() { $direction_suffix = is_rtl() ? '-rtl' : ''; wp_register_style( 'elementor-admin', $this->get_css_assets_url( 'admin' . $direction_suffix ), [ 'elementor-common', ], ELEMENTOR_VERSION ); wp_enqueue_style( 'elementor-admin' ); // It's for upgrade notice. // TODO: enqueue this just if needed. add_thickbox(); } /** * Print switch mode button. * * Adds a switch button in post edit screen (which has cpt support). To allow * the user to switch from the native WordPress editor to Elementor builder. * * Fired by `edit_form_after_title` action. * * @since 1.0.0 * @access public * * @param \WP_Post $post The current post object. */ public function print_switch_mode_button( $post ) { // Exit if Gutenberg are active. if ( did_action( 'enqueue_block_editor_assets' ) ) { return; } if ( ! User::is_current_user_can_edit( $post->ID ) ) { return; } wp_nonce_field( basename( __FILE__ ), '_elementor_edit_mode_nonce' ); ?>