<?php
/**
 * Laundry Cleaning functions and definitions
 *
 * @package Laundry Cleaning
 */

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

	global $content_width;

	if ( ! isset( $content_width ) ) {
		$content_width = 640;
	}

	// Theme version
	if ( ! defined( 'LAUNDRY_CLEANING_VERSION' ) ) {
		define( 'LAUNDRY_CLEANING_VERSION', wp_get_theme()->get( 'Version' ) );
	}

	// Load text domain
	load_theme_textdomain( 'laundry-cleaning', get_template_directory() . '/languages' );

	// Theme supports
	add_theme_support( 'post-thumbnails' );
	add_theme_support( 'title-tag' );

	add_theme_support( 'custom-logo', array(
		'height'      => 240,
		'width'       => 240,
		'flex-height' => true,
	) );

	add_theme_support( 'custom-background', array(
		'default-color' => 'ffffff',
	) );

	add_theme_support( 'wp-block-styles' );
	add_theme_support( 'align-wide' );
	add_theme_support( 'responsive-embeds' );

	// WooCommerce
	add_theme_support( 'woocommerce' );

	// Editor styles
	add_editor_style( array( 'assets/css/editor-style.css' ) );

}
endif;
add_action( 'after_setup_theme', 'laundry_cleaning_setup' );

/**
 * Enqueue scripts and styles
 */
function laundry_cleaning_scripts() {

	$laundry_cleaning_version = LAUNDRY_CLEANING_VERSION;

	// Main stylesheet
	wp_enqueue_style(
		'laundry-cleaning-basic-style',
		get_stylesheet_uri(),
		array(),
		$laundry_cleaning_version
	);

	// Animate CSS
	wp_enqueue_style(
		'animate-css',
		get_template_directory_uri() . '/assets/css/animate.css',
		array(),
		$laundry_cleaning_version
	);

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

	// Owl Carousel CSS
	wp_enqueue_style(
		'owl-carousel-style',
		get_template_directory_uri() . '/assets/css/owl.carousel.css',
		array(),
		$laundry_cleaning_version
	);

	// WOW JS
	wp_enqueue_script(
		'wow-js',
		get_template_directory_uri() . '/assets/js/wow.js',
		array( 'jquery' ),
		$laundry_cleaning_version,
		true
	);

	// Owl Carousel JS
	wp_enqueue_script(
		'owl-carousel-js',
		get_template_directory_uri() . '/assets/js/owl.carousel.js',
		array( 'jquery' ),
		$laundry_cleaning_version,
		true
	);

	// Main Script
	wp_enqueue_script(
		'laundry-cleaning-main-script',
		get_template_directory_uri() . '/assets/js/script.js',
		array( 'jquery', 'wow-js' ),
		$laundry_cleaning_version,
		true
	);

	// RTL support
	wp_style_add_data( 'laundry-cleaning-basic-style', 'rtl', 'replace' );
}
add_action( 'wp_enqueue_scripts', 'laundry_cleaning_scripts' );

// Block Patterns
require get_template_directory() . '/block-patterns.php';