<?php
/**
 * Pet Care Store functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Pet Care Store
 */


if ( ! function_exists( 'pet_care_store_setup' ) ) :

	function pet_care_store_setup() {
		add_theme_support( 'automatic-feed-links' );
		add_theme_support( 'align-wide' );
		add_theme_support( 'woocommerce' );
		add_theme_support( 'wp-block-styles' );
		add_theme_support(
			'custom-logo',
			array(
				'height'      => 192,
				'width'       => 192,
				'flex-width'  => true,
				'flex-height' => true,
			)
		);
		add_theme_support( 'block-nav-menus' );
		add_theme_support( 'experimental-link-color' );
		register_nav_menus(
			array(
				'primary' => __( 'Primary Navigation', 'pet-care-store' ),
			)
		);
	// Enqueue editor styles.
	add_editor_style(get_stylesheet_directory_uri() . '/css/editor-style.css');
	}
endif;
add_action( 'after_setup_theme', 'pet_care_store_setup' );

/**
 * Enqueue scripts and styles.
 */
function pet_care_store_scripts() {

    $Pet_Care_Store_Theme_version = wp_get_theme()->get( 'Version' );

    $deps = array( 'dashicons' );
    global $wp_styles;

    if ( isset($wp_styles->queue) && in_array( 'wc-blocks-vendors-style', $wp_styles->queue ) ) {
        $deps[] = 'wc-blocks-vendors-style';
    }

    // Styles
    wp_enqueue_style( 'bootstrap-style', get_template_directory_uri().'/css/bootstrap.css', array(), $Pet_Care_Store_Theme_version );

    wp_enqueue_style( 'pet-care-store-style',
        get_stylesheet_uri(),
        $deps,
        date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) )
    );

    wp_style_add_data('pet-care-store-style', 'rtl', 'replace');

    wp_enqueue_style( 'fontawesome-style', get_template_directory_uri().'/css/fontawesome/css/all.css', array(), $Pet_Care_Store_Theme_version );

    wp_enqueue_style( 'animatecss', get_template_directory_uri() . '/css/animate.css', array(), $Pet_Care_Store_Theme_version );

    wp_enqueue_style( 'owl.carousel-css', get_template_directory_uri() . '/css/owl.carousel.css', array(), '2.3.4' );


    // Scripts
    wp_enqueue_script( 'bootstrap-js',
        get_template_directory_uri(). '/js/bootstrap.js',
        array('jquery'),
        $Pet_Care_Store_Theme_version,
        true
    );

    wp_enqueue_script( 'wow-script',
        get_template_directory_uri() . '/js/wow.js',
        array('jquery'),
        $Pet_Care_Store_Theme_version,
        true
    );

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

    wp_enqueue_script( 'pet-care-store-main-script',
        get_template_directory_uri() . '/js/script.js',
        array('jquery'),
        $Pet_Care_Store_Theme_version,
        true
    );
}

add_action( 'wp_enqueue_scripts', 'pet_care_store_scripts' );

/**
 * Enqueue admin scripts and styles.
 */
function pet_care_store_admin_scripts() {
    wp_enqueue_style(
        'pet-care-store-admin-css',
        get_template_directory_uri() . '/notice-getstart/theme-info.css',
        array(),
        wp_get_theme()->get( 'Version' )
    );
}
add_action( 'admin_enqueue_scripts', 'pet_care_store_admin_scripts' );

/**
 * Load core file.
 */
require_once get_template_directory() . '/core/init.php';

/**
 * Current theme path.
 * Current theme url.
 * Current theme version.
 * Current theme name.
 * Current theme option name.
*/
define( 'PET_CARE_STORE_PATH', trailingslashit( get_template_directory() ) );
define( 'PET_CARE_STORE_URL', trailingslashit( get_template_directory_uri() ) );
define( 'PET_CARE_STORE_VERSION', wp_get_theme()->get( 'Version' ) );
define( 'PET_CARE_STORE_THEME_NAME', 'pet-care-store' );
define( 'PET_CARE_STORE_OPTION_NAME', 'pet-care-store' );

/**
 * The core admin onboarding class.
 */
require PET_CARE_STORE_PATH . 'notice-getstart/main.php';

/**
 * TGM
 */
require_once get_template_directory() . '/core/tgm/tgm.php';

/**
 * Begins execution of the theme.
 */
function pet_care_store_run() {
    new Pet_Care_Store_Theme();
}
pet_care_store_run();