admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'bigbang-pagebuilder-nonce' ), 'hideString' => esc_html__( 'Disable section', 'bigbang' ), ) ); } // Ask user if he wants to disable default styling for plugin. if ( $had_elementor == 'no' && bigbang_is_elementor_preview() ) { wp_enqueue_script( 'bigbang-elementor-notice', get_template_directory_uri() . '/assets/js/bigbang-elementor-notice.js', array(), bigbang_VERSION ); wp_localize_script( 'bigbang-elementor-notice', 'bigbangElementorNotice', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'bigbang-elementor-notice-nonce' ), ) ); } } }// End if(). add_action( 'wp_enqueue_scripts', 'bigbang_pagebuilder_enqueue' ); if ( ! function_exists( 'bigbang_elementor_default_styles' ) ) { /** * Enqueue default bigbang styles for elementor. */ function bigbang_elementor_default_styles() { $disabled_color_schemes = get_option( 'elementor_disable_color_schemes' ); $disabled_typography_schemes = get_option( 'elementor_disable_typography_schemes' ); if ( $disabled_color_schemes === 'yes' && $disabled_typography_schemes === 'yes' ) { wp_enqueue_style( 'bigbang-elementor-style', get_template_directory_uri() . '/assets/css/page-builder-style.css', array(), bigbang_VERSION ); } } } if ( class_exists( 'Elementor\Plugin' ) ) { add_action( 'elementor/frontend/after_enqueue_styles', 'bigbang_elementor_default_styles' ); add_action( 'elementor/editor/after_enqueue_scripts', 'bigbang_elementor_enqueue' ); } if ( ! function_exists( 'bigbang_pagebuilder_hide_frontpage_section' ) ) { /** * Section deactivation */ function bigbang_pagebuilder_hide_frontpage_section() { $nonce = $_POST['nonce']; if ( ! wp_verify_nonce( $nonce, 'bigbang-pagebuilder-nonce' ) ) { return; } $section = $_POST['section']; if ( ! empty( $section ) ) { if ( $section == 'products' ) { $theme_mod = esc_html( 'bigbang_shop_hide' ); } else { $theme_mod = esc_html( 'bigbang_' . $section . '_hide' ); } if ( ! empty( $theme_mod ) ) { set_theme_mod( $theme_mod, 1 ); } } die(); } } add_action( 'wp_ajax_bigbang_pagebuilder_hide_frontpage_section', 'bigbang_pagebuilder_hide_frontpage_section' ); if ( ! function_exists( 'bigbang_elementor_deactivate_default_styles' ) ) { /** * Elementor default styles disabling. */ function bigbang_elementor_deactivate_default_styles() { $nonce = $_POST['nonce']; if ( ! wp_verify_nonce( $nonce, 'bigbang-elementor-notice-nonce' ) ) { return; } $reply = $_POST['reply']; if ( ! empty( $reply ) ) { if ( $reply == 'yes' ) { update_option( 'elementor_disable_color_schemes', 'yes' ); update_option( 'elementor_disable_typography_schemes', 'yes' ); } update_option( 'bigbang_had_elementor', 'yes' ); } die(); } } add_action( 'wp_ajax_bigbang_elementor_deactivate_default_styles', 'bigbang_elementor_deactivate_default_styles' ); if ( ! function_exists( 'bigbang_elementor_enqueue' ) ) { /** * Enqueue Pagebuilder Specific Script */ function bigbang_elementor_enqueue() { $had_elementor = get_option( 'bigbang_had_elementor' ); // Ask user if he wants to disable default styling for plugin. if ( $had_elementor == 'no' && bigbang_is_elementor_preview() ) { wp_enqueue_script( 'bigbang-elementor-notice', get_template_directory_uri() . '/assets/js/bigbang-elementor-notice.js', array(), bigbang_VERSION ); wp_localize_script( 'bigbang-elementor-notice', 'bigbangElementorNotice', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'bigbang-elementor-notice-nonce' ), ) ); } } }// End if(). if ( ! function_exists( 'bigbang_is_elementor_preview' ) ) { /** * Check if we're in Elementor Preview. * * @return bool */ function bigbang_is_elementor_preview() { if ( class_exists( 'Elementor\Plugin' ) ) { if ( Elementor\Plugin::$instance->preview->is_preview_mode() == true ) { return true; } } return false; } } if ( ! function_exists( 'bigbang_is_beaver_preview' ) ) { /** * Check if we're in Beaver Builder Preview. * * @return bool */ function bigbang_is_beaver_preview() { if ( class_exists( 'FLBuilderModel' ) ) { if ( FLBuilderModel::is_builder_active() == true ) { return true; } } return false; } }