<?php

/**
 * Enqueue scripts and styles.
 */
function bexplore_scripts()
{
    //  bootstrap stylesheet.
    wp_enqueue_style('bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', [], null);

    //  Fontawesome V5 stylesheet.
    wp_enqueue_style('fontawesome-5', get_template_directory_uri() . '/assets/css/all.min.css', [], null);

    // Swiper css added
    wp_enqueue_style('swiper-css', get_template_directory_uri() . '/assets/css/swiper.min.css', [], null);

    // Theme stylesheet.
    wp_enqueue_style('bexplore-style', get_stylesheet_uri(), [], BEXPLORE_VERSION);

    // Add main stylesheet
    wp_enqueue_style('bexplore-blog-main-style', get_template_directory_uri() . '/assets/css/bexplore-style.css', [], BEXPLORE_VERSION);

    // Add responsive stylesheet
    wp_enqueue_style('bexplore-blog-responsive', get_template_directory_uri() . '/assets/css/responsive.css', [], null);


    /**
     * Load All jQuery Library
     */
    wp_enqueue_script('bexplore-blog-navigation', get_template_directory_uri() . '/assets/js/navigation.js', [], BEXPLORE_VERSION, true);

    wp_enqueue_script('bexplore-blog-bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', [], BEXPLORE_VERSION, true);

    wp_enqueue_script('bexplore-blog-popper', get_template_directory_uri() . '/assets/js/popper.min.js', [], BEXPLORE_VERSION, true);

    wp_enqueue_script('swiper-js', get_template_directory_uri() . '/assets/js/swiper.min.js', ['jquery'], BEXPLORE_VERSION, true);

    wp_enqueue_script('imagesloaded-js', get_template_directory_uri() . '/assets/js/imagesloaded.pkgd.min.js', ['jquery'], BEXPLORE_VERSION, true);

    wp_enqueue_script('masonry-js', get_template_directory_uri() . '/assets/js/masonry.pkgd.min.js', ['imagesloaded-js','jquery'], BEXPLORE_VERSION, true);

    // Add bexplore-main js library
    wp_enqueue_script('bexplore-scripts-js', get_template_directory_uri() . '/assets/js/bexplore-scripts.js', ['jquery'], '', true);

    // Custom Banner JS
	wp_enqueue_script(
		'banner-slider-js',
		get_template_directory_uri() . '/assets/js/banner.js',
		array('swiper-js'), // Depends on Swiper JS
		'1.0.0',
		true
	);

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

add_action('wp_enqueue_scripts', 'bexplore_scripts');


function bexplore_customizer()
{
    wp_enqueue_script('bexplore-customizer', get_template_directory_uri() . '/assets/js/customizer.js', ['jquery', 'customize-preview'], BEXPLORE_VERSION, true);
}

add_action('customize_preview_init', 'bexplore_customizer');