<?php
/**
 * Project Manager functions and definitions
 *
 * @package project-manager
 * @since 1.0
 */

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

		load_theme_textdomain( 'project-manager', 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', 'project_manager_theme_support' );

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

		$project_manager_version_string = is_string( $project_manager_theme_version ) ? $project_manager_theme_version : false;
		wp_enqueue_style(
			'project-manager-style',
			get_template_directory_uri() . '/style.css',
			array(),
			$project_manager_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( 'project-manager-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(
		    'project-manager-custom-script',
		    get_template_directory_uri() . '/assets/js/custom-script.js',
		    array('jquery'),
		    $project_manager_version_string,
		    true
		);
	}
endif;

add_action( 'wp_enqueue_scripts', 'project_manager_styles' );


// 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';