=' ) ) { require_once AMELA_DIR . '/includes/compatibility/class-amela-elementor.php'; } /** * Theme styles. */ function amela_theme_styles() { wp_enqueue_style( 'amela-styles', AMELA_URI . '/style.min.css', array(), AMELA_VERSION, 'all' ); wp_style_add_data( 'amela-styles', 'rtl', 'replace' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } // WooCommerce styles if ( amela_is_woocommerce_activated() ) { wp_register_style( 'amela-woocommerce', AMELA_URI . '/assets/css/compatibility/woocommerce/woocommerce.min.css', array(), AMELA_VERSION ); wp_enqueue_style( 'amela-woocommerce' ); wp_style_add_data( 'amela-woocommerce', 'rtl', 'replace' ); } // Cookies bar styles if ( get_theme_mod( 'amela_settings_cookies_bar_show', false ) ) { wp_enqueue_style( 'cookieconsent', AMELA_URI . '/assets/css/cookieconsent.min.css' ); } // Fonts if ( !class_exists( 'Kirki' ) ) { wp_enqueue_style( 'amela-google-fonts', '//fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,700;1,400&family=Prata:wght@400&display=swap' ); } } add_action( 'wp_enqueue_scripts', 'amela_theme_styles' ); // Remove Woo styles add_filter( 'woocommerce_enqueue_styles', '__return_false' ); // Dequeue YITH Wishlist styles if ( defined( 'YITH_WCWL' ) && amela_is_woocommerce_activated() ) { function amela_dequeue_yith_wcwl_font_awesome_styles( $deps ) { $deps = array( 'jquery-selectBox' ); return $deps; } add_filter( 'yith_wcwl_main_style_deps', 'amela_dequeue_yith_wcwl_font_awesome_styles' ); // Remove social icon color style add_filter( 'yith_wcwl_custom_css_rules', function ( $custom_css ) { unset( $custom_css['color_fb_button'], $custom_css['color_tw_button'], $custom_css['color_pr_button'], $custom_css['color_em_button'], $custom_css['color_wa_button'], $custom_css['color_wa_button'] ); return $custom_css; } ); } /** * Block editor styles. */ function amela_block_assets() { wp_enqueue_style( 'amela-block-editor-styles', get_theme_file_uri( '/assets/css/editor.min.css' ), false ); if ( function_exists( 'amela_get_typekit_fonts' ) ) { $typekit_fonts = amela_get_typekit_fonts(); } if ( !empty($typekit_fonts) ) { $typekit_info = get_option( 'amela-typekit-fonts' ); $typekit_id = $typekit_info['custom-typekit-font-id']; if ( !empty($typekit_id) ) { wp_enqueue_style( 'amela-typekit-fonts', '//use.typekit.net/' . $typekit_id . '.css' ); } } if ( !class_exists( 'Kirki' ) || empty($typekit_fonts) ) { wp_enqueue_style( 'amela-block-editor-google-fonts', '//fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,700;1,400&family=Prata:wght@400&display=swap' ); } } add_action( 'enqueue_block_editor_assets', 'amela_block_assets' ); /** * Theme scripts. */ function amela_theme_scripts() { if ( is_archive() || is_search() || is_home() ) { wp_enqueue_script( 'masonry' ); wp_enqueue_script( 'imagesloaded' ); } wp_enqueue_script( 'bootstrap', AMELA_URI . '/assets/js/vendor/min/bootstrap.min.js', array(), AMELA_VERSION, true ); wp_enqueue_script( 'body-scroll-lock', AMELA_URI . '/assets/js/vendor/min/bodyScrollLock.min.js', array(), AMELA_VERSION, true ); wp_enqueue_script( 'modernizr', AMELA_URI . '/assets/js/vendor/min/modernizr.min.js', array(), AMELA_VERSION, true ); if ( amela_is_woocommerce_activated() ) { wp_enqueue_script( 'amela-woo-scripts', AMELA_URI . '/assets/js/woo-scripts.min.js', array(), AMELA_VERSION, true ); } wp_register_script( 'amela-scripts', AMELA_URI . '/assets/js/scripts.min.js', array(), AMELA_VERSION, true ); wp_enqueue_script( 'amela-scripts' ); $Amela_Data = array( 'home_url' => esc_url( home_url( '/' ) ), 'theme_path' => AMELA_URI, ); wp_localize_script( 'amela-scripts', 'Amela_Data', $Amela_Data ); } add_action( 'wp_enqueue_scripts', 'amela_theme_scripts' ); /** * Theme admin scripts and styles. */ function amela_admin_scripts() { $screen = get_current_screen(); wp_enqueue_style( 'amela-admin-styles', AMELA_URI . '/assets/admin/css/amela-admin-styles.css' ); if ( $screen->id === 'appearance_page_one-click-demo-import' ) { wp_register_script( 'amela-admin-scripts', AMELA_URI . '/assets/admin/js/amela-admin-scripts.js', array( 'jquery-core' ), false, true ); wp_enqueue_script( 'amela-admin-scripts' ); } } add_action( 'admin_enqueue_scripts', 'amela_admin_scripts' ); /** * Theme WP Customizer scripts and styles. */ function amela_customizer_scripts() { wp_enqueue_style( 'amela-customizer-styles', AMELA_URI . '/assets/css/customizer/customizer.css' ); } add_action( 'customize_controls_enqueue_scripts', 'amela_customizer_scripts' );