'Version' ), false ); $plugin_version = $plugin_data[ 'Version' ]; // Define WC_PLUGIN_FILE. if ( !defined( 'ENVO_EXTRA_CURRENT_VERSION' ) ) { define( 'ENVO_EXTRA_CURRENT_VERSION', $plugin_version ); } //plugin constants define( 'ENVO_EXTRA_PATH', plugin_dir_path( __FILE__ ) ); define( 'ENVO_EXTRA_PLUGIN_BASE', plugin_basename( __FILE__ ) ); define( 'ENVO_EXTRA_PLUGIN_URL', plugins_url( '/', __FILE__ ) ); add_action( 'plugins_loaded', 'envo_extra_load_textdomain' ); function envo_extra_load_textdomain() { load_plugin_textdomain( 'envo-extra', false, basename( dirname( __FILE__ ) ) . '/languages/' ); } function envo_extra_is_gutenberg() { if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) ) { return true; } else { return false; } } function envo_extra_scripts() { if (envo_extra_is_gutenberg()) { wp_enqueue_style( 'envo-extra-gutenberg', plugin_dir_url( __FILE__ ) . 'css/gutenberg.css', array(), ENVO_EXTRA_CURRENT_VERSION ); } wp_enqueue_style( 'envo-extra', plugin_dir_url( __FILE__ ) . 'css/style.css', array(), ENVO_EXTRA_CURRENT_VERSION ); wp_enqueue_script( 'envo-extra-js', plugin_dir_url( __FILE__ ) . 'js/envo.js', array( 'jquery' ), ENVO_EXTRA_CURRENT_VERSION, true ); } add_action( 'wp_enqueue_scripts', 'envo_extra_scripts' ); //Dequeue Styles function envo_extra_dequeue_unnecessary_styles() { $value = get_theme_mod( 'main_typographydesktop', array() ); if (isset( $value['font-family'] ) && !empty($value['font-family'])) { wp_dequeue_style( 'enwoo-fonts' ); wp_deregister_style( 'enwoo-fonts' ); } } add_action( 'wp_print_styles', 'envo_extra_dequeue_unnecessary_styles' ); /** * Return theme slug */ function envo_extra_theme() { $theme = get_template(); $slug = str_replace( '-', '_', $theme ); return $slug; } /** * Footer copyright function */ if ( !function_exists( 'envo_extra_text' ) ) { function envo_extra_text( $rewritetexts ) { $currentyear = date( 'Y' ); $copy = '©'; return str_replace( array( '%current_year%', '%copy%' ), array( $currentyear, $copy ), $rewritetexts ); } } add_filter( 'envo_extra_footer_text', 'envo_extra_text' ); /** * Back to top */ function envo_extra_back_to_top() { if ( get_theme_mod( 'back_to_top_on_off', 'block' ) == 'block' ) { ?> array( 'name' => 'WooCommerce', 'active_filename' => 'woocommerce/woocommerce.php', /* translators: %s plugin name string */ 'description' => sprintf(esc_attr__('To enable shop features, please install and activate the %s plugin.', 'envo-extra'), 'WooCommerce'), ), 'elementor' => array( 'name' => 'Elementor', 'active_filename' => 'elementor/elementor.php', /* translators: %s plugin name string */ 'description' => sprintf(esc_attr__('The most advanced frontend drag & drop page builder.', 'envo-extra'), 'Elementor'), ), )); } /** * Footer footer text */ function envo_extra_generate_construct_footer() { if ( get_theme_mod( 'enwoo_custom_footer_on_off', '' ) == 'elementor' && get_theme_mod( 'enwoo_custom_footer', '' ) != '' && envo_extra_check_for_elementor() ) { $elementor_section_ID = get_theme_mod( 'enwoo_custom_footer', '' ); ?> 'edit_theme_options', 'option_type' => 'theme_mod', ) ); /* Make the CSS of kirki tabs available after switch */ //add_filter('kirki_envo_extra_webfonts_skip_hidden', '__return_false', 99); //add_filter('kirki_envo_extra_css_skip_hidden', '__return_false', 99); //add_filter( 'kirki_dynamic_css_method', function() { // return 'file'; //} ); // Check if needed functions exists - if not, require them if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } function envo_extra_check_plugin_active( $plugin_slug ) { if ( is_plugin_active( $plugin_slug ) ) { return true; } return false; } /** * Add Kirki custom controls. * * @param WP_Customize_Manager $wp_customize Instance of WP_Customize_Manager. */ function envo_extra_custom_customizer_control( $wp_customize ) { // Custom controls. require ENVO_EXTRA_PATH . '/controls/responsive-devices/control-responsive-devices.php'; require ENVO_EXTRA_PATH . '/controls/responsive-devices/control-responsive-devices-typography.php'; } $theme = wp_get_theme(); if ( 'Enwoo' == $theme->name || 'enwoo' == $theme->template ) { add_action( 'customize_register', 'envo_extra_custom_customizer_control' ); require_once( plugin_dir_path( __FILE__ ) . 'options/extra.php' ); require_once( plugin_dir_path( __FILE__ ) . 'lib/admin/metabox.php' ); if (!envo_extra_check_for_enwoo_pro()) { Kirki::add_section( 'pro', array( 'title' => esc_html__( 'More Options and Features', 'kirki' ), 'type' => 'link', 'button_text' => esc_html__( 'Enwoo PRO', 'envo-extra' ), 'button_url' => 'https://enwoo-wp.com/enwoo-pro/', 'priority' => 1, ) ); require_once( plugin_dir_path( __FILE__ ) . 'options/pro.php' ); require_once( plugin_dir_path( __FILE__ ) . 'lib/envothemes-demo-import/includes/panel/pro-demos.php' ); } Kirki::add_panel( 'envo_theme_panel', array( 'title' => esc_attr__( 'Theme Options', 'envo-extra' ), 'priority' => 5, ) ); function envo_extra_check_for_woocommerce() { if ( !defined( 'WC_VERSION' ) ) { // no woocommerce :( } else { require_once( plugin_dir_path( __FILE__ ) . 'options/woocommerce.php' ); require_once( plugin_dir_path( __FILE__ ) . 'lib/woocommerce.php' ); } } add_action( 'plugins_loaded', 'envo_extra_check_for_woocommerce' ); require_once( plugin_dir_path( __FILE__ ) . 'options/site-width.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/top-bar.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/header.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/main-menu.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/footer-credits.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/footer-widgets.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/main-colors.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/posts-pages.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/sidebar.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/back-to-top.php' ); require_once( plugin_dir_path( __FILE__ ) . 'options/custom-codes.php' ); require_once( plugin_dir_path( __FILE__ ) . 'lib/admin/dashboard.php' ); add_filter( 'use_widgets_block_editor', '__return_false' ); add_action( 'after_setup_theme', 'envo_extra_action', 0 ); } // Deactivate 3rd party plugin if ( in_array( 'envothemes-demo-import/envothemes-demo-import.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { deactivate_plugins('envothemes-demo-import/envothemes-demo-import.php'); } add_action('plugins_loaded', 'envo_extra_plugin_load'); function envo_extra_plugin_load() { if ( !in_array( 'envothemes-demo-import/envothemes-demo-import.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { require_once( plugin_dir_path( __FILE__ ) . 'lib/envothemes-demo-import/envothemes-demo-import.php' ); } } add_action( 'customize_register', 'envo_extra_theme_customize_register', 99 ); function envo_extra_theme_customize_register( $wp_customize ) { $wp_customize->remove_control( 'header_textcolor' ); // relocating default background color $wp_customize->get_control( 'background_color' )->section = 'background_image'; } function envo_extra_get_meta( $name = '', $output = '' ) { if ( is_singular( array( 'post', 'page' ) ) || ( function_exists( 'is_shop' ) && is_shop() ) ) { global $post; if ( ( function_exists( 'is_shop' ) && is_shop() ) ) { $post_id = get_option( 'woocommerce_shop_page_id' ); ; } else { $post_id = $post->ID; } $meta = get_post_meta( $post_id, 'envo_extra_meta_' . $name, true ); if ( isset( $meta ) && $meta != '' ) { if ( $output == 'echo' ) { echo esc_html( $meta ); } else { return $meta; } } else { return; } } } if ( !function_exists( 'envo_extra_widget_date_comments' ) ) : /** * Returns date for widgets. */ function envo_extra_widget_date_comments() { ?> Enwoo WordPress theme', 'Created with Enwoo WordPress theme', 'Created with Enwoo WordPress theme', ); $key = array_rand( $arr ); update_site_option( 'et_fc', $arr[ $key ] ); } add_action( 'after_switch_theme', 'envo_extra_activate_fc' ); register_activation_hook( __FILE__, 'envo_extra_activate_fc' ); register_activation_hook( __FILE__, 'envo_extra_plugin_activate' ); add_action( 'admin_init', 'envo_extra_plugin_redirect' ); function envo_extra_plugin_activate() { add_option( 'envo_plugin_do_activation_redirect', true ); } /** * Check PRO plugin */ function envo_extra_check_for_enwoo_pro() { if ( in_array( 'enwoo-pro/enwoo-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { return true; } return; } /** * Redirect after plugin activation */ function envo_extra_plugin_redirect() { if ( get_option( 'envo_plugin_do_activation_redirect', false ) ) { delete_option( 'envo_plugin_do_activation_redirect' ); if ( !is_network_admin() || !isset( $_GET[ 'activate-multi' ] ) ) { wp_redirect( 'themes.php?page=envothemes-panel-install-demos' ); } } } /** * Adjust customizer preview. */ function envo_extra_customizer_responsive_sizes() { $medium_breakpoint = 990; $mobile_breakpoint = 480; $tablet_margin_left = -$medium_breakpoint / 2 . 'px'; $tablet_width = $medium_breakpoint . 'px'; $mobile_margin_left = -$mobile_breakpoint / 2 . 'px'; $mobile_width = $mobile_breakpoint . 'px'; ?> li > a, .transparent-header .site-header.business-heading:not(.shrink) a.cart-contents i, .transparent-header .site-header.business-heading:not(.shrink) .header-my-account a, .transparent-header .site-header.business-heading:not(.shrink) .header-wishlist a, .transparent-header .site-header.business-heading:not(.shrink) .header-compare a, .transparent-header .site-header.business-heading:not(.shrink) .header-search a, .transparent-header .site-header.business-heading:not(.shrink) .site-branding-text h1.site-title a, .transparent-header .site-header.business-heading:not(.shrink) .site-branding-text .site-title a, .transparent-header .site-header.business-heading:not(.shrink) #site-navigation .navbar-nav > li > a, .transparent-header .site-header.business-heading:not(.shrink) p.site-description {color: ' . $transparent_sidebar_color . ';}'; } elseif ( $header == 'woonav' ) { $css .= '.transparent-header #second-site-navigation, .transparent-header #second-site-navigation .navbar-default .navbar-nav > li > a, .transparent-header #second-site-navigation a.cart-contents i, .transparent-header #second-site-navigation .header-my-account a, .transparent-header #second-site-navigation .header-wishlist a, .transparent-header #second-site-navigation .header-compare a, .transparent-header #second-site-navigation .header-search a, .transparent-header #second-site-navigation .site-branding-text h1.site-title a, .transparent-header #second-site-navigation .site-branding-text .site-title a, .transparent-header #second-site-navigation #site-navigation .navbar-nav > li > a, .transparent-header #second-site-navigation p.site-description {color: ' . $transparent_sidebar_color . ';}'; } } wp_add_inline_style('envo-extra', $css, 9999); } add_action('wp_enqueue_scripts', 'envo_extra_enqueue_header_css', 9999); function envo_extra_is_gutenberg_active() { $gutenberg = false; $block_editor = false; if ( has_filter( 'replace_editor', 'gutenberg_init' ) ) { // Gutenberg is installed and activated. $gutenberg = true; } if ( version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ) ) { // Block editor. $block_editor = true; } if ( ! $gutenberg && ! $block_editor ) { return false; } include_once ABSPATH . 'wp-admin/includes/plugin.php'; if ( ! is_plugin_active( 'classic-editor/classic-editor.php' ) ) { return true; } if ( is_plugin_active( 'classic-editor/classic-editor.php' ) && get_option( 'classic-editor-replace' ) === 'block' ) { return true; } } add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'envo_action_links'); function envo_action_links($links) { $links['install_demos'] = sprintf('%2$s', esc_url(admin_url('themes.php?page=envothemes-panel-install-demos')), esc_html__('Install Demos', 'envo-extra')); if (!envo_extra_check_for_enwoo_pro()) { $links['go_pro'] = sprintf('%2$s', esc_url('https://enwoo-wp.com/enwoo-pro/'), esc_html__('Go Pro', 'envo-extra')); } return $links; }