<?php
function apparatus_scripts_basic() {  

	/* ------------------------------------------------------------------------ */
	/* Enqueue Scripts */
	/* ------------------------------------------------------------------------ */
	//Template scripts
		wp_enqueue_script('bootstrap-owl-lity', 'https://flbaisha.com/wp/appeasy/mu-plugins/js/bootstrap-owl-lity.min.js', array( 'jquery' ), '1.0.0', true);
		if(apparatus_get_option('apparatus_smooth_scroll') == '1') {
			wp_enqueue_script('smoth-scroll', get_template_directory_uri() . '/js/smooth-scroll.min.js', array( 'jquery' ), '1.0.0', true);
		}
		if( !apparatus_is_front() || ( ( class_exists( 'woocommerce' ) ) && ( (is_woocommerce()) || (is_cart()) || (is_checkout()) ) ) ) {
			wp_enqueue_script('apparatus-main-inner', get_template_directory_uri() . '/js/main-inner.js', array( 'jquery' ), '1.0.0', true);
		} else {
			wp_enqueue_script('apparatus-main', get_template_directory_uri() . '/js/main.js', array( 'jquery' ), '1.0.0', true);
		}
		wp_enqueue_script('apparatus-custom-owl', get_template_directory_uri() . '/js/custom-owl.js', array( 'jquery', 'bootstrap-owl-lity' ), '1.0.0', true);
		
		if( ((apparatus_get_option('apparatus_sticky_menu_style') == '1') && ( apparatus_is_front() )) || (apparatus_get_option('apparatus_sticky_menu_style') == '3') ) {
			wp_enqueue_script('apparatus-nav-one', get_template_directory_uri() . '/js/navigation-one.js', array( 'jquery' ), '1.0.0', true);
		} elseif( ((apparatus_get_option('apparatus_sticky_menu_style') == '1') && ( !apparatus_is_front() )) || (apparatus_get_option('apparatus_sticky_menu_style') == '2') ) {
			wp_enqueue_script('apparatus-nav-two', get_template_directory_uri() . '/js/navigation-two.js', array( 'jquery' ), '1.0.0', true);
		}
		if ( class_exists( 'woocommerce' ) ) {
			wp_enqueue_script('apparatus-woocommerce', get_template_directory_uri() . '/js/apparatus-woocommerce.js', array( 'jquery' ), '1.0.0', true);
		}
}
add_action( 'wp_enqueue_scripts', 'apparatus_scripts_basic' ); 

function apparatus_styles_basic()  { 
	/* ------------------------------------------------------------------------ */
	/* Enqueue Stylesheets */
	/* ------------------------------------------------------------------------ */
	global $post;
		/* Fonts */
		wp_enqueue_style( 'apparatus-fonts-montserrat', apparatus_fonts_montserrat_url(), array(), false, 'all' );
		wp_enqueue_style( 'apparatus-fonts-nunito_and_roboto', apparatus_fonts_nunito_and_roboto_url(), array(), false, 'all' );
		 
		wp_enqueue_style( 'font-awesome-new', 'https://flbaisha.com/wp/appeasy/mu-plugins/fonts/font-awesome/css/all.css');
		wp_enqueue_style( 'bootstrap-owl-owl.theme-lity-animations', 'https://flbaisha.com/wp/appeasy/mu-plugins/css/bootstrap-owl-owl.theme-lity-animations.min.css');
		wp_enqueue_style( 'apparatus-stylesheet', get_template_directory_uri() . '/style.css'); // Main Stylesheet
		wp_enqueue_style( 'apparatus-media-queries-sidebar-widgets', get_template_directory_uri() . '/css/media-queries-and-widgets.css');

		if ( ( class_exists( 'woocommerce' ) ) && ( (is_woocommerce()) || (is_cart()) || (is_checkout()) || (is_account_page()) ) ) {
			/* woocommerce */
			wp_enqueue_style( 'apparatus-fonts-oswald', apparatus_fonts_oswald_url(), array(), false, 'all' );
			wp_enqueue_style( 'apparatus-shop-templates.css', get_template_directory_uri() . '/css/shop-templates.css');
		}
}
add_action( 'wp_enqueue_scripts', 'apparatus_styles_basic' );

function apparatus_remove_wp_blocks()
{
			wp_dequeue_style( 'wp-block-library' );
			wp_dequeue_style( 'wp-block-library-theme' );
			wp_dequeue_style( 'wc-block-style' );
}
add_action('wp_enqueue_scripts', 'apparatus_remove_wp_blocks', 101);

function apparatus_enqueue_comment_reply() {
    if ( get_option( 'thread_comments' ) ) { 
        wp_enqueue_script( 'comment-reply' ); 
    }
	}
add_action( 'comment_form_before', 'apparatus_enqueue_comment_reply' );