<?php
/*
	Scripts and Styles (SS)
*/
if (!is_admin()) {
	add_action('wp_enqueue_scripts', 'stm_load_theme_ss');
}

function stm_load_theme_ss()
{

	// Styles
	wp_enqueue_style('boostrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', NULL, STM_THEME_VERSION, 'all');
	wp_enqueue_style('font-awesome-min', get_template_directory_uri() . '/assets/css/font-awesome.min.css', NULL, STM_THEME_VERSION, 'all');
	wp_enqueue_style('font-icomoon', get_template_directory_uri() . '/assets/css/icomoon.fonts.css', NULL, STM_THEME_VERSION, 'all');
	wp_enqueue_style('select2-min', get_template_directory_uri() . '/assets/css/select2.min.css', NULL, STM_THEME_VERSION, 'all');
	wp_enqueue_style('theme-style-less', get_template_directory_uri() . '/assets/css/styles.css', NULL, STM_THEME_VERSION, 'all');
	wp_enqueue_style('fancyboxcss', get_template_directory_uri() . '/assets/css/jquery.fancybox.css', NULL, STM_THEME_VERSION, 'all');
	wp_enqueue_style('animate.css', get_template_directory_uri() . '/assets/css/animate.css', NULL, STM_THEME_VERSION, 'all');


	stm_module_styles('layout_styles', stm_get_layout(), 'theme-style-less');
	/*Added*/
	wp_register_style('owl.carousel', get_template_directory_uri() . '/assets/css/owl.carousel.min.css', NULL, STM_THEME_VERSION, 'all');

	// Animations
	if (!wp_is_mobile()) {
		wp_enqueue_style('theme-style-animation', get_template_directory_uri() . '/assets/css/animation.css', NULL, STM_THEME_VERSION, 'all');
	}

	$header_style = stm_option('header_style', 'header_default');
	stm_module_styles('headers', $header_style);
	stm_module_styles('headers_transparent', "{$header_style}_transparent");

	// Theme main stylesheet
	wp_enqueue_style('theme-style', get_stylesheet_uri(), null, STM_THEME_VERSION, 'all');

	if (function_exists('stm_lms_custom_styles_url') and file_exists(stm_lms_custom_styles_url(true, true) . 'custom_styles.css')) {
		wp_enqueue_style('stm_custom_styles', stm_lms_custom_styles_url(true) . 'custom_styles.css', array(), stm_lms_custom_styles_v());
	}

	// Scripts
	if (is_singular() && comments_open() && get_option('thread_comments')) {
		wp_enqueue_script('comment-reply');
	}

	wp_enqueue_script('jquerymigrate', get_template_directory_uri() . '/assets/js/jquery-migrate-1.2.1.min.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_enqueue_script('bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_enqueue_script('fancyboxjs', get_template_directory_uri() . '/assets/js/jquery.fancybox.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_enqueue_script('select2-full-min', get_template_directory_uri() . '/assets/js/select2.full.min.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_enqueue_script('custom', get_template_directory_uri() . '/assets/js/custom.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_enqueue_script('ajaxsubmit', get_template_directory_uri() . '/assets/js/ajax.submit.js', 'jquery', STM_THEME_VERSION, TRUE);


	/*Deleted*/
	//wp_enqueue_script( 'jquery.touchSwipe.min',   get_template_directory_uri() . '/assets/js/jquery.touchSwipe.min.js', 'jquery', STM_THEME_VERSION,
	//wp_enqueue_script( 'fredseljs',   get_template_directory_uri() . '/assets/js/jquery.carouFredSel-6.2.1.min.js', 'jquery', STM_THEME_VERSION, TRUE );TRUE );

	/*Added*/
	wp_register_script('owl.carousel', get_template_directory_uri() . '/assets/js/owl.carousel.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_register_script('imagesloaded', get_template_directory_uri() . '/assets/js/imagesloaded.pkgd.min.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_register_script('isotope', get_template_directory_uri() . '/assets/js/isotope.pkgd.min.js', 'jquery', STM_THEME_VERSION, TRUE);
	wp_register_script('countUp.min.js', get_template_directory_uri() . '/assets/js/countUp.min.js', array('jquery'), STM_THEME_VERSION, true);
	wp_register_script('jquery.countdown', get_template_directory_uri() . '/assets/js/jquery.countdown.js', 'jquery', STM_THEME_VERSION, TRUE);

	wp_register_script('vue.js', get_template_directory_uri() . '/assets/js/vue.min.js', array('jquery'), STM_THEME_VERSION);
	wp_register_script('vue-resource.js', get_template_directory_uri() . '/assets/js/vue-resource.min.js', array('vue.js'), STM_THEME_VERSION);


	/*POSTS*/
	if (is_post_type_archive(array('events'))) {
		stm_module_styles('event_grid');
	} elseif (is_post_type_archive('gallery')) {
		stm_module_styles('gallery_grid');
		wp_enqueue_script('imagesloaded');
		wp_enqueue_script('isotope');
		stm_module_scripts('gallery_grid');
	} elseif (is_post_type_archive('teachers')) {
		stm_module_styles('teachers_grid');
	} elseif (is_post_type_archive('product')) {
		stm_module_styles('featured_products');
	}


	/*AOS*/
	wp_register_script('aos.js', get_template_directory_uri() . '/assets/js/aos.js', array(), STM_THEME_VERSION);
	wp_register_style('aos.css', get_template_directory_uri() . '/assets/css/aos.css', array(), STM_THEME_VERSION);


}

// Admin styles
function admin_styles()
{
	wp_enqueue_style('theme-admin-styles', get_template_directory_uri() . '/assets/css/admin.css', null, STM_THEME_VERSION, 'all');
	wp_enqueue_style('icomoon-mstudy', get_template_directory_uri() . '/assets/css/icomoon.fonts.css', null, STM_THEME_VERSION, 'all');
	//wp_enqueue_style('font-awesome-min', get_template_directory_uri() . '/assets/css/font-awesome.min.css', NULL, STM_THEME_VERSION, 'all');

	wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css', NULL, STM_THEME_VERSION, 'all');
}

add_action('admin_enqueue_scripts', 'admin_styles');