get_contents( $dynamic_url ); wp_add_inline_style( $custom_css_handle, $data ); } // Scripts wp_register_script( 'alpus-sidebar', alpus_framework_uri( '/assets/js/sidebar' . ALPUS_JS_SUFFIX ), array( 'jquery-core' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-sticky-lib', alpus_framework_uri( '/assets/js/sticky' . ALPUS_JS_SUFFIX ), array( 'jquery-core' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-framework', alpus_framework_uri( '/assets/js/framework' . ALPUS_JS_SUFFIX ), array( 'jquery-core' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-framework-async', alpus_framework_uri( '/assets/js/framework-async' . ALPUS_JS_SUFFIX ), array( 'alpus-framework' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-woocommerce', alpus_framework_uri( '/assets/js/woocommerce/woocommerce' . ALPUS_JS_SUFFIX ), array( 'alpus-framework' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-shop', alpus_framework_uri( '/assets/js/woocommerce/shop' . ALPUS_JS_SUFFIX ), array( 'alpus-woocommerce' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-single-product', alpus_framework_uri( '/assets/js/woocommerce/single-product' . ALPUS_JS_SUFFIX ), array( 'alpus-woocommerce' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-ajax', alpus_framework_uri( '/assets/js/ajax' . ALPUS_JS_SUFFIX ), array( 'alpus-framework' ), ALPUS_VERSION, true ); wp_register_script( 'alpus-theme', ALPUS_JS . '/theme' . ALPUS_JS_SUFFIX, array( 'alpus-framework-async' ), ALPUS_VERSION, true ); wp_register_script( 'isotope-pkgd', ALPUS_ASSETS . '/vendor/isotope/isotope.pkgd' . ALPUS_JS_SUFFIX, array( 'jquery-core', 'imagesloaded' ), '3.0.6', true ); wp_register_script( 'jquery-cookie', ALPUS_ASSETS . '/vendor/jquery.cookie/jquery.cookie' . ALPUS_JS_SUFFIX, array(), '1.4.1', true ); wp_register_script( 'jquery-count-to', ALPUS_ASSETS . '/vendor/jquery.count-to/jquery.count-to' . ALPUS_JS_SUFFIX, array( 'jquery-core' ), false, true ); wp_register_script( 'jquery-fitvids', ALPUS_ASSETS . '/vendor/jquery.fitvids/jquery.fitvids.min.js', array( 'jquery-core' ), false, true ); wp_register_script( 'alpus-lightbox', ALPUS_ASSETS . '/vendor/lightbox/lightbox' . ALPUS_JS_SUFFIX, array( 'jquery-core', 'imagesloaded' ), '1.1.0', true ); // if ( ! defined( 'ELEMENTOR_VERSION' ) ) { wp_register_script( 'swiper', ALPUS_ASSETS . '/vendor/swiper/swiper' . ALPUS_JS_SUFFIX, '6.7.0', true ); // } } /** * Enqueue styles and scripts for admin. * * @since 1.0 */ public function enqueue_admin_scripts() { wp_register_style( 'alpus-admin-google-font', '//fonts.googleapis.com/css?family=Poppins', array(), ALPUS_VERSION ); wp_register_style( 'fontawesome-free', ALPUS_ASSETS . '/vendor/fontawesome-free/css/all.min.css', array(), '5.14.0' ); wp_register_style( 'jquery-select2', ALPUS_ASSETS . '/vendor/select2/select2.css', array(), '4.0.3' ); wp_register_style( 'alpus-lightbox', ALPUS_ASSETS . '/vendor/lightbox/lightbox' . ( is_rtl() ? '-rtl' : '' ) . '.min.css', array(), '1.0' ); wp_register_script( 'isotope-pkgd', ALPUS_ASSETS . '/vendor/isotope/isotope.pkgd' . ALPUS_JS_SUFFIX, array( 'jquery-core', 'imagesloaded' ), '3.0.6', true ); wp_register_script( 'alpus-lightbox', ALPUS_ASSETS . '/vendor/lightbox/lightbox' . ALPUS_JS_SUFFIX, array( 'jquery-core', 'imagesloaded' ), '1.1.0', true ); wp_register_script( 'jquery-select2', ALPUS_ASSETS . '/vendor/select2/select2' . ALPUS_JS_SUFFIX, array( 'jquery' ), '4.0.3', true ); // Admin Scripts wp_enqueue_style( 'alpus-admin-google-font' ); wp_enqueue_style( 'fontawesome-free' ); wp_enqueue_style( 'alpus-admin-dynamic', ALPUS_CSS . '/dynamic_vars.min.css', array(), ALPUS_VERSION ); wp_enqueue_style( 'alpus-admin', alpus_framework_uri( '/admin/admin/admin' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_VERSION ); wp_enqueue_script( 'alpus-admin', alpus_framework_uri( '/admin/admin/admin' . ALPUS_JS_SUFFIX ), array( 'jquery-core' ), ALPUS_VERSION, true ); wp_enqueue_script( 'wp-color-picker' ); // Load google font wp_enqueue_style( 'alpus-admin-fonts', apply_filters( 'alpus_admin_fonts', '//fonts.googleapis.com/css?family=Poppins%3A400%2C500%2C600%2C700' ) ); wp_localize_script( 'alpus-admin', 'alpus_admin_vars', apply_filters( 'alpus_admin_vars', array( 'theme' => ALPUS_NAME, 'theme_icon_prefix' => ALPUS_ICON_PREFIX, 'theme_display_name' => ALPUS_DISPLAY_NAME, 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'dummy_url' => ALPUS_SERVER_URI . 'dummy/api/api', 'nonce' => wp_create_nonce( 'alpus-admin' ), ) ) ); } /** * Enqueue frontend styles. * * @since 1.0 */ public function enqueue_styles() { wp_enqueue_style( 'alpus-animate' ); /** * Fires before enqueue theme style. * * @since 1.0 */ do_action( 'alpus_before_enqueue_theme_style' ); /** * Filters the critical css. * * @since 1.0 */ $critical_css = apply_filters( 'alpus_critical_css', 'body{opacity: 0; overflow-x: hidden}' ); echo '' . PHP_EOL; /** * Fires after enqueue theme style. * * @since 1.0 */ do_action( 'alpus_after_enqueue_theme_style' ); } /** * Enqueue custom css. * * @since 1.0 */ public function enqueue_custom_css() { // Enqueue Page CSS if ( function_exists( 'alpus_is_elementor_preview' ) && alpus_is_elementor_preview() ) { wp_enqueue_script( 'isotope-pkgd' ); wp_enqueue_script( 'isotope-plugin' ); wp_enqueue_script( 'jquery-countdown' ); } /** * Fires after enqueue custom style. * * @since 1.0 */ do_action( 'alpus_after_enqueue_custom_style' ); } /** * Enqueue frontend scripts and localize vars. * * @since 1.0 */ public function enqueue_scripts() { wp_enqueue_script( 'imagesloaded' ); wp_enqueue_script( 'alpus-framework' ); wp_enqueue_script( 'alpus-framework-async' ); $layout = alpus_get_page_layout(); if ( 'archive_product' == $layout || ( class_exists( 'WooCommerce' ) && is_cart() ) ) { // Product Archive Page // shop wp_enqueue_script( 'alpus-shop' ); } elseif ( 'archive_' == substr( $layout, 0, 8 ) ) { // Blog Page // blog } elseif ( 'single_page' == $layout ) { // Page if ( ( defined( 'YITH_WCWL' ) && function_exists( 'yith_wcwl_is_wishlist_page' ) && yith_wcwl_is_wishlist_page() ) || ( class_exists( 'WooCommerce' ) && ( is_cart() || is_checkout() || ( function_exists( 'alpus_is_compare' ) && alpus_is_compare() ) ) ) ) { // cart or checkout wp_enqueue_script( 'alpus-woocommerce' ); alpus_quickview_add_scripts(); } } elseif ( 'single_product' == $layout ) { // Single Product Page // single product wp_enqueue_script( 'alpus-single-product' ); } elseif ( 'single_' == substr( $layout, 0, 7 ) ) { // Single Post Page // single post } $localize_vars = array( 'theme' => ALPUS_NAME, 'theme_icon_prefix' => ALPUS_ICON_PREFIX, 'alpus_gap' => ALPUS_GAP, 'home_url' => esc_url( home_url( '/' ) ), 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'nonce' => wp_create_nonce( 'alpus-nonce' ), 'lazyload' => alpus_get_option( 'lazyload' ), 'container' => alpus_get_option( 'container' ), 'assets_url' => ALPUS_ASSETS, 'texts' => array( 'loading' => esc_html__( 'Loading...', 'alpus' ), 'loadmore_error' => esc_html__( 'Loading failed', 'alpus' ), 'popup_error' => esc_html__( 'The content could not be loaded.', 'alpus' ), 'quick_access' => esc_attr__( 'Click to edit this element.', 'alpus' ), ), 'resource_split_tasks' => alpus_get_option( 'resource_split_tasks' ), 'resource_after_load' => alpus_get_option( 'resource_after_load' ), 'alpus_cache_key' => 'alpus_cache_' . MD5( home_url() ), 'lazyload_menu' => alpus_get_option( 'lazyload_menu' ), 'countdown' => array( 'labels' => array( esc_html__( 'Years', 'alpus' ), esc_html__( 'Months', 'alpus' ), esc_html__( 'Weeks', 'alpus' ), esc_html__( 'Days', 'alpus' ), esc_html__( 'Hours', 'alpus' ), esc_html__( 'Minutes', 'alpus' ), esc_html__( 'Seconds', 'alpus' ), ), 'labels_short' => array( esc_html__( 'Years', 'alpus' ), esc_html__( 'Months', 'alpus' ), esc_html__( 'Weeks', 'alpus' ), esc_html__( 'Days', 'alpus' ), esc_html__( 'Hrs', 'alpus' ), esc_html__( 'Mins', 'alpus' ), esc_html__( 'Secs', 'alpus' ), ), 'label1' => array( esc_html__( 'Year', 'alpus' ), esc_html__( 'Month', 'alpus' ), esc_html__( 'Week', 'alpus' ), esc_html__( 'Day', 'alpus' ), esc_html__( 'Hour', 'alpus' ), esc_html__( 'Minute', 'alpus' ), esc_html__( 'Second', 'alpus' ), ), 'label1_short' => array( esc_html__( 'Year', 'alpus' ), esc_html__( 'Month', 'alpus' ), esc_html__( 'Week', 'alpus' ), esc_html__( 'Day', 'alpus' ), esc_html__( 'Hour', 'alpus' ), esc_html__( 'Min', 'alpus' ), esc_html__( 'Sec', 'alpus' ), ), ), ); // Scripts for page editors (edit link tooltip) if ( current_user_can( 'edit_pages' ) ) { wp_enqueue_script( 'bootstrap-tooltip', ALPUS_ASSETS . '/vendor/bootstrap/bootstrap.tooltip' . ALPUS_JS_SUFFIX, array( 'jquery-core' ), '4.1.3', true ); } if ( alpus_get_option( 'lazyload_menu' ) ) { $localize_vars['menu_last_time'] = alpus_get_option( 'menu_last_time' ); } if ( alpus_get_option( 'skeleton_screen' ) ) { $localize_vars['skeleton_screen'] = true; $localize_vars['posts_per_page'] = get_query_var( 'posts_per_page' ); } if ( alpus_get_option( 'archive_ajax' ) && ( is_archive() || is_home() || is_search() ) && ! alpus_is_shop() ) { $localize_vars['blog_ajax'] = 1; } // @start feature: fs_plugin_woocommerce if ( class_exists( 'WooCommerce' ) && alpus_get_option( 'compare_available' ) ) { $localize_vars['compare_limit'] = alpus_get_option( 'compare_limit' ); } // @end feature: fs_plugin_woocommerce // @start feature: fs_pb_elementor if ( alpus_get_feature( 'fs_pb_elementor' ) && defined( 'ELEMENTOR_VERSION' ) ) { // if ( class_exists( 'Elementor\Plugin' ) && Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_assets_loading' ) ) { // $localize_vars['swiper_url'] = plugins_url( 'elementor/assets/lib/swiper/swiper' . ALPUS_JS_SUFFIX ); // } /** * Filters the resource that disable elementor. * * @since 1.0 */ if ( apply_filters( 'alpus_resource_disable_elementor', alpus_get_option( 'resource_disable_elementor' ) ) && ! current_user_can( 'edit_pages' ) ) { $localize_vars['resource_disable_elementor'] = 1; } } // @end feature: fs_pb_elementor // @start feature: fs_plugin_woocommerce if ( class_exists( 'WooCommerce' ) ) { /** * Filters whether current page is vendor or not. * * @since 1.0 */ if ( alpus_get_option( 'archive_ajax' ) && ! apply_filters( 'alpus_is_vendor_store', false ) && alpus_is_shop() ) { $localize_vars['shop_ajax'] = 1; } $localize_vars = array_merge_recursive( $localize_vars, array( 'home_url' => esc_js( home_url( '/' ) ), 'shop_url' => esc_url( get_permalink( wc_get_page_id( 'shop' ) ) ), 'post_type' => get_post_type(), 'quickview_type' => alpus_get_option( 'quickview_type' ), 'quickview_thumbs' => alpus_get_option( 'quickview_thumbs' ), 'quickview_wrap_1' => esc_js( 'col-md-6' ), 'quickview_wrap_2' => esc_js( 'col-md-6' ), 'quickview_percent' => esc_js( '50%' ), 'prod_open_click_mob' => alpus_get_option( 'prod_open_click_mob' ), 'texts' => array( /* translators: %d represents loaded products count. */ 'show_info_all' => esc_html__( 'all %d', 'alpus' ), 'already_voted' => esc_html__( 'You already voted!', 'alpus' ), 'view_checkout' => esc_html__( 'Checkout', 'alpus' ), 'view_cart' => esc_html__( 'View Cart', 'alpus' ), 'add_to_wishlist' => esc_html__( 'Add to wishlist', 'alpus' ), 'cart_suffix' => esc_html__( 'has been added to cart', 'alpus' ), 'select_category' => esc_js( __( 'Select a category', 'alpus' ) ), 'no_matched' => esc_js( _x( 'No matches found', 'enhanced select', 'alpus' ) ), ), 'pages' => array( 'cart' => wc_get_page_permalink( 'cart' ), 'checkout' => wc_get_page_permalink( 'checkout' ), ), 'single_product' => array( 'zoom_enabled' => true, 'zoom_options' => array(), ), 'cart_auto_update' => alpus_get_option( 'cart_auto_update' ), 'cart_show_qty' => alpus_get_option( 'cart_show_qty' ), ) ); } // @end feature: fs_plugin_woocommerce /** * Filters the vars. * * @since 1.0 */ wp_localize_script( 'alpus-framework', 'alpus_vars', apply_filters( 'alpus_vars', $localize_vars ) ); if ( ! empty( $localize_vars['shop_ajax'] ) || ! empty( $localize_vars['blog_ajax'] ) ) { wp_enqueue_script( 'alpus-ajax' ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } /** * Enqueue theme js at last. * * @since 1.2.0 */ public function enqueue_theme_js_css() { // Theme js wp_enqueue_script( 'alpus-theme' ); // Theme page style $custom_css_handle = 'alpus-theme'; $layout = alpus_get_page_layout(); if ( 'archive_product' == $layout ) { // Product Archive Page $custom_css_handle = 'alpus-theme-shop'; if ( defined( 'ALPUS_CORE_VERSION' ) ) { wp_enqueue_style( 'alpus-product', alpus_core_framework_uri( '/widgets/products/product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); } wp_enqueue_style( 'alpus-theme-single-product', ALPUS_ASSETS . '/css/pages/single-product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css', array(), ALPUS_VERSION ); } elseif ( 'archive_' == substr( $layout, 0, 8 ) ) { // Blog Page $custom_css_handle = 'alpus-theme-blog'; if ( defined( 'ALPUS_CORE_VERSION' ) ) { wp_enqueue_style( 'alpus-post', alpus_core_framework_uri( '/widgets/posts/post' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); } } elseif ( 'single_page' == $layout ) { // Page if ( ( defined( 'YITH_WCWL' ) && function_exists( 'yith_wcwl_is_wishlist_page' ) && yith_wcwl_is_wishlist_page() ) || ( class_exists( 'WooCommerce' ) && is_account_page() ) ) { $custom_css_handle = 'alpus-theme-shop-other'; if ( defined( 'ALPUS_CORE_VERSION' ) ) { wp_enqueue_style( 'alpus-product', alpus_core_framework_uri( '/widgets/products/product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); } wp_enqueue_style( 'alpus-theme-single-product', ALPUS_ASSETS . '/css/pages/single-product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css', array(), ALPUS_VERSION ); } // Compare Page if ( ( class_exists( 'WooCommerce' ) && function_exists( 'alpus_is_compare' ) && alpus_is_compare() ) && defined( 'ALPUS_CORE_VERSION' ) ) { wp_enqueue_style( 'alpus-product', alpus_core_framework_uri( '/widgets/products/product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); } } elseif ( 'single_product' == $layout ) { // Single Product Page $custom_css_handle = 'alpus-theme-single-product'; if ( defined( 'ALPUS_CORE_VERSION' ) ) { wp_enqueue_style( 'alpus-tab', alpus_core_framework_uri( '/widgets/tab/tab' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); wp_enqueue_style( 'alpus-accordion', alpus_core_framework_uri( '/widgets/accordion/accordion' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); wp_enqueue_style( 'alpus-product', alpus_core_framework_uri( '/widgets/products/product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); } wp_enqueue_script( 'photoswipe' ); } elseif ( 'cart' == $layout || 'checkout' == $layout ) { $custom_css_handle = 'alpus-theme-shop-other'; if ( defined( 'ALPUS_CORE_VERSION' ) && 'cart' == $layout ) { wp_enqueue_style( 'alpus-product', alpus_core_framework_uri( '/widgets/products/product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); } wp_enqueue_style( 'alpus-theme-single-product', ALPUS_ASSETS . '/css/pages/single-product' . ( is_rtl() ? '-rtl' : '' ) . '.min.css', array(), ALPUS_VERSION ); } elseif ( 'single_' == substr( $layout, 0, 7 ) ) { // Single Post Page $custom_css_handle = 'alpus-theme-single-post'; if ( defined( 'ALPUS_CORE_VERSION' ) ) { wp_enqueue_style( 'alpus-post', alpus_core_framework_uri( '/widgets/posts/post' . ( is_rtl() ? '-rtl' : '' ) . '.min.css' ), array(), ALPUS_CORE_VERSION ); } } wp_enqueue_style( 'alpus-theme' ); wp_enqueue_style( 'alpus-dynamic-vars' ); if ( 'alpus-theme' != $custom_css_handle ) { wp_enqueue_style( $custom_css_handle ); } /** * Fires before enqueue custom style. * * @since 1.0 */ do_action( 'alpus_before_enqueue_custom_css' ); // Theme Style wp_enqueue_style( 'alpus-style' ); // Global css if ( ! is_customize_preview() ) { $custom_css = alpus_get_option( 'custom_css' ); if ( $custom_css ) { wp_add_inline_style( 'alpus-style', '/* Global CSS */' . PHP_EOL . wp_strip_all_tags( wp_specialchars_decode( $custom_css ) ) ); } } // Getting Page ID if ( class_exists( 'WooCommerce' ) && is_shop() ) { // Shop Page $page_id = wc_get_page_id( 'shop' ); } elseif ( is_home() && get_option( 'page_for_posts' ) ) { // Blog Page $page_id = get_option( 'page_for_posts' ); } elseif ( is_archive() || is_search() ) { $page_id = get_queried_object_id(); } else { $page_id = get_the_ID(); } $page_css = ''; $meta_type = 'post'; if ( is_tax() ) { $meta_type = 'term'; } if ( ! ( function_exists( 'alpus_is_elementor_preview' ) && alpus_is_elementor_preview() ) ) { $page_css = get_metadata( $meta_type, intval( $page_id ), 'page_css', true ); } $page_css .= get_metadata( $meta_type, $page_id, ALPUS_NAME . '_blocks_style_options_css', true ); if ( $page_css ) { wp_add_inline_style( 'alpus-style', '/* Page CSS */' . PHP_EOL . wp_strip_all_tags( $page_css ) ); } wp_enqueue_style( 'fontawesome-free' ); wp_enqueue_style( 'alpus-icons' ); // Styles for page editors (edit link tooltip) if ( current_user_can( 'edit_pages' ) ) { wp_enqueue_style( 'bootstrap-tooltip', ALPUS_ASSETS . '/vendor/bootstrap/bootstrap.tooltip.css', array(), '4.1.3' ); } alpus_load_google_font(); } /** * Enqueue custom js. * * @since 1.0 */ public function enqueue_custom_js() { global $alpus_layout; $global_js = alpus_get_option( 'custom_js' ); if ( $global_js ) { ?> $value ) { $script = get_post_meta( $block_id, 'page_js', true ); if ( $script ) { ?>