implode( '&family=', $font_families ), //urlencode( implode( '|', $font_families ) ), // 'subset' => urlencode( 'latin,latin-ext' ), 'display' => 'swap', ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css2' ); } if ( ! class_exists( 'WPTT_WebFont_Loader' ) ) { // Load Google fonts from Local. require_once get_theme_file_path( 'inc/wptt-webfont-loader.php' ); } return esc_url( wptt_get_webfont_url( $fonts_url ) ); } endif; /** * Enqueue scripts and styles. */ function business_spark_scripts() { $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; // Register theme stylesheet. $theme_version = wp_get_theme()->get( 'Version' ); $font_families = business_spark_theme_font_families(); if ( ! empty( $font_families ) ) { wp_enqueue_style( 'business-spark-fonts', business_spark_fonts_url(), array(), null ); } if ( file_exists( get_template_directory() . '/js/animate' . $min . '.js' ) ) { $deps = array( 'jquery' ); wp_enqueue_script( 'business-spark-animate', get_template_directory_uri() . '/js/animate' . $min . '.js', $deps, date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) ) ); } } add_action( 'wp_enqueue_scripts', 'business_spark_scripts' ); /** * Enqueue admin scripts and styles. */ function business_spark_admin_scripts() { $deps = array(); // FontAwesome. wp_register_style( 'business-spark-admin-style', get_template_directory_uri() . '/css/admin-style.css', $deps, date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) ) ); $handle = 'business-spark-admin'; wp_localize_script( $handle, 'business_spark', array( 'business_spark_kit_gallery' => esc_url( admin_url( 'admin.php?page=business-spark-template-kits' ) ), 'business_spark_nonce' => wp_create_nonce( "business_spark-nonce" ), ) ); if ( ! empty( $_GET['page'] ) && 'business-spark-info' === $_GET['page'] ) { wp_enqueue_style( 'business-spark-admin-style' ); wp_enqueue_script( 'business-spark-admin' ); } } add_action( 'admin_enqueue_scripts', 'business_spark_admin_scripts' ); /** * * Enqueue scripts and styles. */ function business_spark_editor_styles() { $font_families = business_spark_theme_font_families(); if ( empty( $font_families ) ) { return false; } // Enqueue editor styles. add_editor_style( array( business_spark_fonts_url(), ) ); } add_action( 'admin_init', 'business_spark_editor_styles' ); /** * * Register scripts and styles. */ function business_spark_register_assets() { $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; // FontAwesome. wp_register_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome/css/all' . $min . '.css', array(), '5.15.3', 'all' ); $deps = array( 'font-awesome' ); if ( file_exists( get_template_directory() . '/css/animate.css' ) ) { wp_register_style( 'business-spark-animate', get_template_directory_uri() . '/css/animate.css', array(), filemtime( get_theme_file_path( '/css/animate.css' ) ), 'all' ); $deps[] = 'business-spark-animate'; } global $wp_styles; if ( in_array( 'wc-blocks-vendors-style', $wp_styles->queue ) ) { $deps[] = 'wc-blocks-vendors-style'; } wp_register_style( 'business-spark-style', get_stylesheet_uri(), $deps, date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) ) ); wp_style_add_data( 'business-spark-style', 'rtl', 'replace' ); if ( file_exists( get_template_directory() . '/css/theme-style.css' ) ) { wp_register_style( 'business-spark-theme-style', get_template_directory_uri() . '/css/theme-style.css', array(), date( 'Ymd-Gis', filemtime( get_theme_file_path( 'css/theme-style.css' ) ) ) ); } } add_action( 'init', 'business_spark_register_assets' ); /** * * Enqueue blocks scripts and styles. */ function business_spark_enqueue_block_assets() { wp_enqueue_style( 'business-spark-style' ); wp_enqueue_style( 'business-spark-theme-style' ); } add_action( 'wp_enqueue_scripts', 'business_spark_enqueue_block_assets' ); /** * Load core file. */ require_once get_template_directory() . '/inc/core/bootstrap.php';