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

if ( ! defined( 'HALLOWEEN_GIFT_STORE_VERSION' ) ) {
	// Replace the version number of the theme on each release.
	define( 'HALLOWEEN_GIFT_STORE_VERSION', wp_get_theme()->get( 'Version' ) );
}

if ( ! function_exists( 'halloween_gift_store_setup' ) ) :
	/**
	 * Sets up theme defaults and registers support for various WordPress features.
	 *
	 * Note that this function is hooked into the after_setup_theme hook, which
	 * runs before the init hook. The init hook is too late for some features, such
	 * as indicating support for post thumbnails.
	 */
	function halloween_gift_store_setup() {

		define('HALLOWEEN_GIFT_STORE_LIVE_DEMO',__('https://demos.buywptemplates.com/halloween-gift-store/', 'halloween-gift-store'));
		define('HALLOWEEN_GIFT_STORE_BUY_PRO',__('https://www.buywptemplates.com/products/halloween-wordpress-theme', 'halloween-gift-store'));
		define('HALLOWEEN_GIFT_STORE_PRO_DOC',__('https://demos.buywptemplates.com/demo/docs/halloween-gift-store-pro/', 'halloween-gift-store'));
		define('HALLOWEEN_GIFT_STORE_FREE_DOC',__('https://demos.buywptemplates.com/demo/docs/halloween-gift-store-lite/', 'halloween-gift-store'));
		define('HALLOWEEN_GIFT_STORE_PRO_SUPPORT',__('https://buywptemplates.com/pages/community', 'halloween-gift-store'));
		define('HALLOWEEN_GIFT_STORE_FREE_SUPPORT',__('https://wordpress.org/support/theme/halloween-gift-store/', 'halloween-gift-store'));
		define('HALLOWEEN_GIFT_STORE_REVIEW',__('https://wordpress.org/support/theme/halloween-gift-store/reviews/', 'halloween-gift-store'));	
		define('HALLOWEEN_GIFT_STORE_CREDIT',__('https://www.buywptemplates.com/products/halloween-gift-store', 'halloween-gift-store'));

		load_theme_textdomain( 'halloween-gift-store', get_template_directory() . '/languages' );

		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'automatic-feed-links' );

		add_theme_support( 'align-wide' );

		add_theme_support( 'woocommerce' );

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

		// Enqueue editor styles.
		add_editor_style( 'style.css' );

		// Add support for core custom logo.
		add_theme_support(
			'custom-logo',
			array(
				'height'      => 192,
				'width'       => 192,
				'flex-width'  => true,
				'flex-height' => true,
			)
		);

		// Enqueue editor styles.
		// add_editor_style( 'style.css' );

		// Experimental support for adding blocks inside nav menus
		add_theme_support( 'block-nav-menus' );

		// Add support for experimental link color control.
		add_theme_support( 'experimental-link-color' );
	}
endif;
add_action( 'after_setup_theme', 'halloween_gift_store_setup' );

/**
 * Enqueue scripts and styles.
 */
function halloween_gift_store_scripts() {
	wp_enqueue_style('halloween-gift-store-style', get_stylesheet_uri(), array() );
	wp_enqueue_script( 'halloween-gift-jquery-wow', esc_url(get_template_directory_uri()) .'/js/wow.js', array('jquery') );
	wp_enqueue_style( 'halloween-gift-animate-css', esc_url(get_template_directory_uri()).'/css/animate.css' );
	wp_enqueue_style('halloween-gift-swiper-css', esc_url(get_template_directory_uri())."/css/swiper-bundle.css");
	wp_enqueue_script('halloween-gift-swiper-js', esc_url(get_template_directory_uri()). '/js/swiper-bundle.js', array('jquery'));
	wp_enqueue_script( 'halloween-gift-store-custom-scripts', get_template_directory_uri() . '/js/custom.js', array('jquery'),'' ,true );
	wp_enqueue_style( 'halloween-gift-font-awesome-css', get_template_directory_uri().'/css/fontawesome-all.css' );
	wp_style_add_data( 'halloween-gift-store-style', 'rtl', 'replace' );
}
add_action( 'wp_enqueue_scripts', 'halloween_gift_store_scripts' );

/**
 * Enqueue block editor style
 */
function halloween_gift_store_block_editor_styles() {
	wp_enqueue_style( 'halloween-gift-store-block-patterns-style-editor', get_theme_file_uri( '/css/block-editor.css' ), false, '1.0', 'all' );	
}
add_action( 'enqueue_block_editor_assets', 'halloween_gift_store_block_editor_styles' );

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

	/**
	 * TGM
	 */
	require_once get_template_directory() . '/inc/tgm/tgm.php';
}
add_action( 'after_setup_theme', 'halloween_gift_store_init_setup' );	


/* Load welcome message.*/
require get_template_directory() . '/inc/dashboard/get_started_info.php';

/**
 * Section Pro
 */
require get_template_directory() . '/inc/section-pro/customizer.php';