<?php
/**
 * Vehicle Rental functions and definitions
 *
 * @package vehicle-rental
 * @since 1.0
 */

if ( ! function_exists( 'vehicle_rental_support' ) ) :
	function vehicle_rental_support() {

		load_theme_textdomain( 'vehicle-rental', get_template_directory() . '/languages' );

		// Add support for block styles.
		add_theme_support( 'wp-block-styles' );

		add_theme_support('woocommerce');

		// Enqueue editor styles.
		add_editor_style(get_stylesheet_directory_uri() . '/assets/css/editor-style.css');
	}

endif;

add_action( 'after_setup_theme', 'vehicle_rental_support' );

if ( ! function_exists( 'vehicle_rental_styles' ) ) :
	function vehicle_rental_styles() {
		// Register theme stylesheet.
		$vehicle_rental_theme_version = wp_get_theme()->get( 'Version' );

		$vehicle_rental_version_string = is_string( $vehicle_rental_theme_version ) ? $vehicle_rental_theme_version : false;
		wp_enqueue_style(
			'vehicle-rental-style',
			get_template_directory_uri() . '/style.css',
			array(),
			$vehicle_rental_version_string
		);

		wp_enqueue_style( 'dashicons' );

		wp_enqueue_style( 'animate-css', esc_url(get_template_directory_uri()).'/assets/css/animate.css' );

		wp_enqueue_script( 'jquery-wow', esc_url(get_template_directory_uri()) . '/assets/js/wow.js', array('jquery') );

		wp_style_add_data( 'vehicle-rental-style', 'rtl', 'replace' );

		//font-awesome
		wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/inc/fontawesome/css/all.css'
			, array(), '7.0.0' );

		wp_enqueue_style( 
			'owl.carousel-style', 
			get_template_directory_uri().'/assets/css/owl.carousel.css' 
		);

		wp_enqueue_script( 
			'owl.carousel-js', 
			get_template_directory_uri(). '/assets/js/owl.carousel.js', 
			array('jquery') ,
			true
		);

		// Enqueue Custom Script
		wp_enqueue_script(
		    'vehicle-rental-custom-script',
		    get_template_directory_uri() . '/assets/js/custom-script.js',
		    array('jquery'),
		    $vehicle_rental_version_string,
		    true
		);
	}
endif;

add_action( 'wp_enqueue_scripts', 'vehicle_rental_styles', 100 );

function wpdocs_dequeue_script() {
	    wp_dequeue_script( 'cretats-admin-owl-carousel' );

	    wp_dequeue_script( 'cretats-public-owl-carousel' );
	    wp_dequeue_script( 'owl-carousel' );
}
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );


// Add block patterns
require get_template_directory() . '/inc/block-patterns.php';

// Add block styles
require get_template_directory() . '/inc/block-styles.php';

// Block Filters
require get_template_directory() . '/inc/block-filters.php';

// Svg icons
require get_template_directory() . '/inc/icon-function.php';