Files

200 lines
10 KiB
PHP
Raw Permalink Normal View History

2026-04-23 04:33:43 +03:30
<?php
defined('ABSPATH') || exit;
function upstudy_scripts() {
wp_enqueue_style( 'upstudy-style', get_stylesheet_uri() );
// Third Party Libraries
wp_enqueue_style( 'upstudy-icomoon', get_template_directory_uri() . '/assets/fonts/icomoon/style.css', array(), UPSTUDY_THEME_VERSION );
if ( Upstudy::setting( 'metismenu_css' ) ) :
wp_enqueue_style( 'metismenu', get_template_directory_uri() . '/assets/css/metisMenu.min.css', array(), UPSTUDY_THEME_VERSION );
endif;
if ( Upstudy::setting( 'nice_select_css' ) ) :
wp_enqueue_style( 'nice-select', get_template_directory_uri() . '/assets/css/nice-select.css', array(), UPSTUDY_THEME_VERSION );
endif;
if ( Upstudy::setting( 'fancybox_css' ) ) :
wp_register_style( 'jquery-fancybox', get_template_directory_uri() . '/assets/css/jquery.fancybox.min.css', array(), UPSTUDY_THEME_VERSION );
endif;
if ( Upstudy::setting( 'tipped_css' ) ) :
wp_enqueue_style( 'upstudy-tipped', get_template_directory_uri() . '/assets/css/tipped.min.css', array(), UPSTUDY_THEME_VERSION );
endif;
if ( Upstudy::setting( 'preloader_show' ) ) :
wp_enqueue_style( 'upstudy-preloader', get_template_directory_uri() . '/assets/css/preloader.css', array(), UPSTUDY_THEME_VERSION );
endif;
if ( is_404() ) {
wp_enqueue_style( 'upstudy-404-page', get_template_directory_uri() . '/assets/css/404-page.css', array(), UPSTUDY_THEME_VERSION );
}
if ( is_home() || is_archive() || is_category() || is_tag() || is_author() || is_date() || is_search() ) {
wp_enqueue_style( 'upstudy-post', get_template_directory_uri() . '/assets/css/post.css', array(), UPSTUDY_THEME_VERSION );
}
if ( is_singular( 'post' ) ) {
wp_enqueue_style( 'upstudy-post-single', get_template_directory_uri() . '/assets/css/post-single.css', array(), UPSTUDY_THEME_VERSION );
}
if ( is_singular() && ( comments_open() || get_comments_number() ) ) {
wp_enqueue_style( 'upstudy-comments', get_template_directory_uri() . '/assets/css/comments.css', array(), UPSTUDY_THEME_VERSION );
}
$header = apply_filters( 'upstudy_get_header_layout', Upstudy::setting( 'upstudy_get_elementor_header' ) ) ?: 'theme-default-header';
// if ( $header === 'theme-default-header' ) {
wp_enqueue_style( 'upstudy-header', get_template_directory_uri() . '/assets/css/header.css', array(), UPSTUDY_THEME_VERSION );
// }
wp_enqueue_style( 'upstudy-page-title', get_template_directory_uri() . '/assets/css/page-title.css', array(), UPSTUDY_THEME_VERSION );
$footer = apply_filters( 'upstudy_get_footer_layout', Upstudy::setting( 'upstudy_get_elementor_footer' ) ) ?: 'theme-default-footer';
if ( $footer === 'theme-default-footer' ) {
wp_enqueue_style( 'upstudy-footer', get_template_directory_uri() . '/assets/css/footer.css', array(), UPSTUDY_THEME_VERSION );
}
if ( Upstudy::setting( 'top_search_enable' ) ) {
wp_enqueue_style( 'upstudy-search', get_template_directory_uri() . '/assets/css/search.css', array(), UPSTUDY_THEME_VERSION );
}
if ( Upstudy::setting( 'login_reg_show' ) ) {
wp_enqueue_style( 'upstudy-login-popup', get_template_directory_uri() . '/assets/css/login-popup.css', array(), UPSTUDY_THEME_VERSION );
}
// Third Party Plugin CSS
if (class_exists('LearnPress')){
wp_enqueue_style('upstudy-learnpress', UPSTUDY_URI . 'assets/css/learnpress.css', array(), UPSTUDY_THEME_VERSION);
}
if (function_exists('tutor')):
wp_enqueue_style('upstudy-tutor', UPSTUDY_URI . 'assets/css/tutor.css', array(), UPSTUDY_THEME_VERSION);
endif;
if ( class_exists('MasterStudy\Lms\Plugin')):
wp_enqueue_style('upstudy-masterstudy', UPSTUDY_URI . 'assets/css/masterstudy.css', array(), UPSTUDY_THEME_VERSION);
endif;
if ( class_exists('LifterLMS')):
wp_enqueue_style('upstudy-lifter', UPSTUDY_URI . 'assets/css/lifter.css', array(), UPSTUDY_THEME_VERSION);
endif;
if ( class_exists('Zoom_Video_Conferencing_Api') ) :
wp_enqueue_style( 'upstudy-zoom', get_template_directory_uri() . '/assets/css/zoom.css', array(), UPSTUDY_THEME_VERSION );
endif;
if ( class_exists( 'WPEMS' ) || class_exists('Tribe__Events__Main') ) :
wp_enqueue_style( 'upstudy-wpem', get_template_directory_uri() . '/assets/css/wpem.css', array(), UPSTUDY_THEME_VERSION );
endif;
if ( class_exists( 'WPEMS' ) && is_singular( 'tp_event' ) || class_exists( 'Tribe__Events__Main' ) && is_singular( 'tribe_events' ) ){
wp_enqueue_style( 'upstudy-team', get_template_directory_uri() . '/assets/css/team.css', array(), UPSTUDY_THEME_VERSION );
}
if (class_exists('Tribe__Events__Filterbar__PUE')):
wp_enqueue_style('upstudy-events-filterbar', UPSTUDY_URI . 'assets/css/filterbar.css', array(), UPSTUDY_THEME_VERSION);
endif;
wp_enqueue_style( 'upstudy-main', get_template_directory_uri() . '/assets/css/main.css', array(), UPSTUDY_THEME_VERSION );
// Global Courses CSS
if (class_exists('SFWD_LMS') || class_exists('LearnPress') || class_exists('Sensei_Main') || function_exists('tutor') || class_exists('MasterStudy\Lms\Plugin') ||class_exists('LifterLMS')) {
wp_enqueue_style('global-courses', UPSTUDY_URI . 'assets/css/global-courses.css', array(), UPSTUDY_THEME_VERSION);
// Course Filter Reset
wp_register_script( 'upstudy-filter-reset', get_template_directory_uri() . '/assets/js/filter-reset.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
}
if ( Upstudy::setting( 'mouse_move_animation_js' ) ) {
wp_enqueue_script( 'upstudy-mouse-animation', get_template_directory_uri() . '/assets/js/upstudy-mouse-move-animation.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
}
wp_enqueue_script( 'upstudy-sal-js', get_template_directory_uri() . '/assets/js/sal.min.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
wp_enqueue_script( 'upstudy-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), UPSTUDY_THEME_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) :
wp_enqueue_script( 'comment-reply' );
endif;
if ( Upstudy::setting( 'back_to_top_show' ) ?: true ) :
wp_enqueue_script( 'upstudy-back-to-top', get_template_directory_uri() . '/assets/js/back-to-top.js', array(), UPSTUDY_THEME_VERSION, true );
endif;
if ( Upstudy::setting( 'smooth_scroll_js' ) ) :
wp_enqueue_script( 'upstudy-smooth-scroll', get_template_directory_uri() . '/assets/js/smooth-scroll.min.js', array(), UPSTUDY_THEME_VERSION, true );
endif;
if ( Upstudy::setting( 'metismenu_js' ) ) :
wp_enqueue_script( 'metismenu', get_template_directory_uri() . '/assets/js/metisMenu.min.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
endif;
if ( Upstudy::setting( 'theia_sticky_sidebar_js' ) ) :
wp_register_script( 'theia-sticky-sidebar', get_template_directory_uri() . '/assets/js/theia-sticky-sidebar.min.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
endif;
if ( Upstudy::setting( 'skip_link_focus_fix_js' ) ) :
wp_enqueue_script( 'upstudy-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), UPSTUDY_THEME_VERSION, true );
endif;
if ( Upstudy::setting( 'tipped_js' ) ) :
wp_enqueue_script( 'upstudy-tipped', get_template_directory_uri() . '/assets/js/tipped.min.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
endif;
if ( Upstudy::setting( 'fancybox_js' ) ) :
wp_register_script( 'jquery-fancybox', get_template_directory_uri() . '/assets/js/jquery.fancybox.min.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
endif;
if ( Upstudy::setting( 'nice_select_js' ) ) :
wp_enqueue_script( 'nice-select', get_template_directory_uri() . '/assets/js/nice-select.min.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
endif;
wp_enqueue_script( 'youtube-popup', get_template_directory_uri() . '/assets/js/youtube-popup.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
if ( Upstudy::setting( 'sticky_header_enable' ) ) {
wp_enqueue_script( 'headroom', get_template_directory_uri() . '/assets/js/headroom.min.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
}
wp_enqueue_script( 'upstudy-init', get_template_directory_uri() . '/assets/js/init.js', array( 'jquery' ), UPSTUDY_THEME_VERSION, true );
// Like for blog single page
if (Upstudy::setting( 'blog_single_like_show' ) && is_single()) {
wp_localize_script('upstudy-init', 'upstudy_like_ajax', ['ajaxurl' => admin_url('admin-ajax.php')]);
}
if ( ! empty( $GLOBALS['upstudy_has_social_share'] ) && $GLOBALS['upstudy_has_social_share'] === true ) {
wp_enqueue_style( 'upstudy-social-share', get_template_directory_uri() . '/assets/css/social-share.css', array(), UPSTUDY_THEME_VERSION );
}
// Sticky Mode: upstudy_sticky_type or scroll_up
$sticky_mode = Upstudy::setting( 'upstudy_sticky_type' ) ?: 'smart'; // default 'smart'
wp_localize_script('upstudy-init', 'upstudy_sticky_data', array(
'mode' => esc_js($sticky_mode),
));
// Cart Animation and Tutor native cart
wp_localize_script( 'upstudy-init', 'upstudy_cart_settings', array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'tutor_nonce'=> wp_create_nonce( 'tutor_nonce' ), // used if tutor remove uses tutor_remove_from_cart AJAX action
'cart_animation' => Upstudy::setting( 'cart_animation' ) ? true : false,
) );
}
add_action( 'wp_enqueue_scripts', 'upstudy_scripts' );
/**
* Register/Enqueue JS/CSS In Admin Panel
*/
function upstudy_register_admin_styles()
{
wp_enqueue_script('upstudy-unloack', UPSTUDY_URI . '/admin/assets/js/upstudy-unloack.js', array('jquery'), '1.0.0');
wp_enqueue_style('upstudy-admin-css', UPSTUDY_URI . '/admin/assets/css/admin.css', array(), UPSTUDY_THEME_VERSION);
}
add_action('admin_enqueue_scripts', 'upstudy_register_admin_styles');