enqueueStyles(); wp_enqueue_style( 'wp-mediaelement' ); do_action( 'calla_elated_enqueue_third_party_styles' ); //is woocommerce installed? if ( calla_elated_is_woocommerce_installed() && calla_elated_load_woo_assets() ) { //include theme's woocommerce styles wp_enqueue_style( 'calla-elated-woo', ELATED_ASSETS_ROOT . '/css/woocommerce.min.css' ); } if ( calla_elated_dashboard_page() ) { wp_enqueue_style('calla-elated-dashboard', ELATED_FRAMEWORK_ADMIN_ASSETS_ROOT. '/css/eltdf-dashboard.css'); } //define files after which style dynamic needs to be included. It should be included last so it can override other files $style_dynamic_deps_array = apply_filters( 'calla_elated_style_dynamic_deps', array() ); if ( file_exists( ELATED_ROOT_DIR . '/assets/css/style_dynamic.css' ) && calla_elated_is_css_folder_writable() && ! is_multisite() ) { wp_enqueue_style( 'calla-elated-style-dynamic', ELATED_ASSETS_ROOT . '/css/style_dynamic.css', $style_dynamic_deps_array, filemtime( ELATED_ROOT_DIR . '/assets/css/style_dynamic.css' ) ); //it must be included after woocommerce styles so it can override it } else if ( file_exists( ELATED_ROOT_DIR . '/assets/css/style_dynamic_ms_id_' . calla_elated_get_multisite_blog_id() . '.css' ) && calla_elated_is_css_folder_writable() && is_multisite() ) { wp_enqueue_style( 'calla-elated-style-dynamic', ELATED_ASSETS_ROOT . '/css/style_dynamic_ms_id_' . calla_elated_get_multisite_blog_id() . '.css', $style_dynamic_deps_array, filemtime( ELATED_ROOT_DIR . '/assets/css/style_dynamic_ms_id_' . calla_elated_get_multisite_blog_id() . '.css' ) ); //it must be included after woocommerce styles so it can override it } //is responsive option turned on? if ( calla_elated_is_responsive_on() ) { wp_enqueue_style( 'calla-elated-modules-responsive', ELATED_ASSETS_ROOT . '/css/modules-responsive.min.css' ); //is woocommerce installed? if ( calla_elated_is_woocommerce_installed() && calla_elated_load_woo_assets() ) { //include theme's woocommerce responsive styles wp_enqueue_style( 'calla-elated-woo-responsive', ELATED_ASSETS_ROOT . '/css/woocommerce-responsive.min.css' ); } //include proper styles if ( file_exists( ELATED_ROOT_DIR . '/assets/css/style_dynamic_responsive.css' ) && calla_elated_is_css_folder_writable() && ! is_multisite() ) { wp_enqueue_style( 'calla-elated-style-dynamic-responsive', ELATED_ASSETS_ROOT . '/css/style_dynamic_responsive.css', array(), filemtime( ELATED_ROOT_DIR . '/assets/css/style_dynamic_responsive.css' ) ); } else if ( file_exists( ELATED_ROOT_DIR . '/assets/css/style_dynamic_responsive_ms_id_' . calla_elated_get_multisite_blog_id() . '.css' ) && calla_elated_is_css_folder_writable() && is_multisite() ) { wp_enqueue_style( 'calla-elated-style-dynamic-responsive', ELATED_ASSETS_ROOT . '/css/style_dynamic_responsive_ms_id_' . calla_elated_get_multisite_blog_id() . '.css', array(), filemtime( ELATED_ROOT_DIR . '/assets/css/style_dynamic_responsive_ms_id_' . calla_elated_get_multisite_blog_id() . '.css' ) ); } } } add_action( 'wp_enqueue_scripts', 'calla_elated_styles' ); } if ( ! function_exists( 'calla_elated_google_fonts_styles' ) ) { /** * Function that includes google fonts defined anywhere in the theme */ function calla_elated_google_fonts_styles() { $font_simple_field_array = calla_elated_options()->getOptionsByType( 'fontsimple' ); if ( ! ( is_array( $font_simple_field_array ) && count( $font_simple_field_array ) > 0 ) ) { $font_simple_field_array = array(); } $font_field_array = calla_elated_options()->getOptionsByType( 'font' ); if ( ! ( is_array( $font_field_array ) && count( $font_field_array ) > 0 ) ) { $font_field_array = array(); } $available_font_options = array_merge( $font_simple_field_array, $font_field_array ); $google_font_weight_array = calla_elated_options()->getOptionValue( 'google_font_weight' ); if ( ! empty( $google_font_weight_array ) && is_array( $google_font_weight_array ) ) { $google_font_weight_array = array_slice( calla_elated_options()->getOptionValue( 'google_font_weight' ), 1 ); } $font_weight_str = '300,300italic,400,400italic,600,700'; if ( ! empty( $google_font_weight_array ) && is_array( $google_font_weight_array ) && $google_font_weight_array !== '' ) { $font_weight_str = implode( ',', $google_font_weight_array ); } $google_font_subset_array = calla_elated_options()->getOptionValue( 'google_font_subset' ); if ( ! empty( $google_font_subset_array ) && is_array( $google_font_subset_array ) ) { $google_font_subset_array = array_slice( calla_elated_options()->getOptionValue( 'google_font_subset' ), 1 ); } $font_subset_str = 'latin-ext'; if ( ! empty( $google_font_subset_array ) && is_array( $google_font_subset_array ) && $google_font_subset_array !== '' ) { $font_subset_str = implode( ',', $google_font_subset_array ); } //default fonts $default_font_family = array( 'Open Sans', 'Crimson Text', 'Allura' ); $modified_default_font_family = array(); foreach ( $default_font_family as $default_font ) { $modified_default_font_family[] = $default_font . ':' . $font_weight_str; } $default_font_string = implode( '|', $modified_default_font_family ); //define available font options array $fonts_array = array(); foreach ( $available_font_options as $font_option ) { //is font set and not set to default and not empty? $font_option_value = calla_elated_options()->getOptionValue( $font_option ); if ( calla_elated_is_font_option_valid( $font_option_value ) && ! calla_elated_is_native_font( $font_option_value ) ) { $font_option_string = $font_option_value . ':' . $font_weight_str; if ( ! in_array( str_replace( '+', ' ', $font_option_value ), $default_font_family ) && ! in_array( $font_option_string, $fonts_array ) ) { $fonts_array[] = $font_option_string; } } } $fonts_array = array_diff( $fonts_array, array( '-1:' . $font_weight_str ) ); $google_fonts_string = implode( '|', $fonts_array ); $protocol = is_ssl() ? 'https:' : 'http:'; //is google font option checked anywhere in theme? if ( count( $fonts_array ) > 0 ) { //include all checked fonts $fonts_full_list = $default_font_string . '|' . str_replace( '+', ' ', $google_fonts_string ); $fonts_full_list_args = array( 'family' => urlencode( $fonts_full_list ), 'subset' => urlencode( $font_subset_str ), ); $calla_elated_fonts = add_query_arg( $fonts_full_list_args, $protocol . '//fonts.googleapis.com/css' ); wp_enqueue_style( 'calla-elated-google-fonts', esc_url_raw( $calla_elated_fonts ), array(), '1.0.0' ); } else { //include default google font that theme is using $default_fonts_args = array( 'family' => urlencode( $default_font_string ), 'subset' => urlencode( $font_subset_str ), ); $calla_elated_fonts = add_query_arg( $default_fonts_args, $protocol . '//fonts.googleapis.com/css' ); wp_enqueue_style( 'calla-elated-google-fonts', esc_url_raw( $calla_elated_fonts ), array(), '1.0.0' ); } } add_action( 'wp_enqueue_scripts', 'calla_elated_google_fonts_styles' ); } if ( ! function_exists( 'calla_elated_scripts' ) ) { /** * Function that includes all necessary scripts */ function calla_elated_scripts() { global $wp_scripts; //init theme core scripts wp_enqueue_script( 'jquery-ui-core' ); wp_enqueue_script( 'jquery-ui-tabs' ); wp_enqueue_script( 'jquery-ui-accordion' ); wp_enqueue_script( 'wp-mediaelement' ); // 3rd party JavaScripts that we used in our theme wp_enqueue_script( 'appear', ELATED_ASSETS_ROOT . '/js/modules/plugins/jquery.appear.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'modernizr', ELATED_ASSETS_ROOT . '/js/modules/plugins/modernizr.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'hoverIntent', ELATED_ASSETS_ROOT . '/js/modules/plugins/jquery.hoverIntent.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'jquery-plugin', ELATED_ASSETS_ROOT . '/js/modules/plugins/jquery.plugin.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'owl-carousel', ELATED_ASSETS_ROOT . '/js/modules/plugins/owl.carousel.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'waypoints', ELATED_ASSETS_ROOT . '/js/modules/plugins/jquery.waypoints.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'fluidvids', ELATED_ASSETS_ROOT . '/js/modules/plugins/fluidvids.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'prettyphoto', ELATED_ASSETS_ROOT . '/js/modules/plugins/jquery.prettyPhoto.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'perfect-scrollbar', ELATED_ASSETS_ROOT . '/js/modules/plugins/perfect-scrollbar.jquery.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'ScrollToPlugin', ELATED_ASSETS_ROOT . '/js/modules/plugins/ScrollToPlugin.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'parallax', ELATED_ASSETS_ROOT . '/js/modules/plugins/parallax.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'waitforimages', ELATED_ASSETS_ROOT . '/js/modules/plugins/jquery.waitforimages.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'jquery-easing-1.3', ELATED_ASSETS_ROOT . '/js/modules/plugins/jquery.easing.1.3.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'isotope', ELATED_ASSETS_ROOT . '/js/modules/plugins/isotope.pkgd.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'packery', ELATED_ASSETS_ROOT . '/js/modules/plugins/packery-mode.pkgd.min.js', array( 'jquery' ), false, true ); do_action( 'calla_elated_enqueue_third_party_scripts' ); if ( calla_elated_is_woocommerce_installed() ) { wp_enqueue_script( 'select2' ); } if ( calla_elated_is_page_smooth_scroll_enabled() ) { wp_enqueue_script( 'tweenLite', ELATED_ASSETS_ROOT . '/js/modules/plugins/TweenLite.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'smoothPageScroll', ELATED_ASSETS_ROOT . '/js/modules/plugins/smoothPageScroll.js', array( 'jquery' ), false, true ); } //include google map api script $google_maps_api_key = calla_elated_options()->getOptionValue( 'google_maps_api_key' ); $google_maps_extensions = ''; $google_maps_extensions_array = apply_filters( 'calla_elated_google_maps_extensions_array', array() ); if ( ! empty( $google_maps_extensions_array ) ) { $google_maps_extensions .= '&libraries='; $google_maps_extensions .= implode( ',', $google_maps_extensions_array ); } if ( ! empty( $google_maps_api_key ) ) { wp_enqueue_script( 'calla-elated-google-map-api', '//maps.googleapis.com/maps/api/js?key=' . esc_attr( $google_maps_api_key ) . $google_maps_extensions, array(), false, true ); } wp_enqueue_script( 'calla-elated-modules', ELATED_ASSETS_ROOT . '/js/modules.min.js', array( 'jquery' ), false, true ); if ( calla_elated_dashboard_page() ) { $dash_array_deps = array( 'jquery-ui-datepicker', 'jquery-ui-sortable' ); wp_enqueue_script('calla-elated-dashboard', ELATED_FRAMEWORK_ADMIN_ASSETS_ROOT. '/js/eltdf-dashboard.js', $dash_array_deps, false, true); wp_enqueue_script('wp-util'); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); wp_enqueue_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), false, 1 ); $colorpicker_l10n = array( 'clear' => esc_html__( 'Clear', 'calla'), 'defaultString' => esc_html__( 'Default', 'calla' ), 'pick' => esc_html__( 'Select Color', 'calla' ), 'current' => esc_html__( 'Current Color', 'calla' ), ); wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n ); } //include comment reply script $wp_scripts->add_data( 'comment-reply', 'group', 1 ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'calla_elated_scripts' ); } if ( ! function_exists( 'calla_elated_theme_setup' ) ) { /** * Function that adds various features to theme. Also defines image sizes that are used in a theme */ function calla_elated_theme_setup() { //add support for feed links add_theme_support( 'automatic-feed-links' ); //add support for post formats add_theme_support( 'post-formats', array( 'gallery', 'link', 'quote', 'video', 'audio' ) ); //add theme support for post thumbnails add_theme_support( 'post-thumbnails' ); //add theme support for title tag add_theme_support( 'title-tag' ); //add theme support for editor style add_editor_style( 'framework/admin/assets/css/editor-style.css' ); //defined content width variable $GLOBALS['content_width'] = apply_filters( 'calla_elated_set_content_width', 1100 ); //define thumbnail sizes add_image_size( 'calla_elated_square', 550, 550, true ); add_image_size( 'calla_elated_landscape', 1100, 550, true ); add_image_size( 'calla_elated_portrait', 550, 1100, true ); add_image_size( 'calla_elated_huge', 1100, 1100, true ); load_theme_textdomain( 'calla', get_template_directory() . '/languages' ); } add_action( 'after_setup_theme', 'calla_elated_theme_setup' ); } if ( ! function_exists( 'calla_elated_enqueue_editor_customizer_styles' ) ) { /** * Enqueue supplemental block editor styles */ function calla_elated_enqueue_editor_customizer_styles() { wp_enqueue_style( 'calla-elated-admin-styles', ELATED_FRAMEWORK_ADMIN_ASSETS_ROOT . '/css/eltdf-modules-admin.css' ); wp_enqueue_style( 'calla-elated-editor-customizer-styles', ELATED_FRAMEWORK_ADMIN_ASSETS_ROOT . '/css/editor-customizer-style.css' ); } // add google font add_action( 'enqueue_block_editor_assets', 'calla_elated_google_fonts_styles' ); // add action add_action( 'enqueue_block_editor_assets', 'calla_elated_enqueue_editor_customizer_styles' ); } if ( ! function_exists( 'calla_elated_is_responsive_on' ) ) { /** * Checks whether responsive mode is enabled in theme options * @return bool */ function calla_elated_is_responsive_on() { return calla_elated_options()->getOptionValue( 'responsiveness' ) !== 'no'; } } if ( ! function_exists( 'calla_elated_rgba_color' ) ) { /** * Function that generates rgba part of css color property * * @param $color string hex color * @param $transparency float transparency value between 0 and 1 * * @return string generated rgba string */ function calla_elated_rgba_color( $color, $transparency ) { if ( $color !== '' && $transparency !== '' ) { $rgba_color = ''; $rgb_color_array = calla_elated_hex2rgb( $color ); $rgba_color .= 'rgba(' . implode( ', ', $rgb_color_array ) . ', ' . $transparency . ')'; return $rgba_color; } } } if ( ! function_exists( 'calla_elated_header_meta' ) ) { /** * Function that echoes meta data if our seo is enabled */ function calla_elated_header_meta() { ?>