<?php
/**
 * Real Estate Valuation functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Real Estate Valuation
 */


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

		load_theme_textdomain( 'real-estate-valuation', get_template_directory() . '/languages' );
		
		add_theme_support( 'html5', array(
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
		) );

		add_theme_support( 'custom-background', apply_filters( 'real_estate_valuation_custom_background', array(
            'default-color' => 'ffffff',
            'default-image' => '',
        )));
		
		add_theme_support( 'wp-block-styles' );

		add_editor_style( 'style.css' );

		define('REAL_ESTATE_VALUATION_BUY_NOW',__('https://www.themescarts.com/products/solar-wordpress-theme/','real-estate-valuation'));
		define('REAL_ESTATE_VALUATION_FOOTER_BUY_NOW',__('https://www.themescarts.com/products/real-estate-valuation/','real-estate-valuation'));

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


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

		load_theme_textdomain( 'real-estate-valuation', get_template_directory() . '/languages' );
		
		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', 'real-estate-valuation' ),
			)
		);
	}
endif;
add_action( 'after_setup_theme', 'real_estate_valuation_setup' );

/**
 * Enqueue scripts and styles.
 */
function real_estate_valuation_scripts() {
	$min  = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

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

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

	wp_enqueue_style( 'real-estate-valuation-style', get_stylesheet_uri(), $deps, date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) ) );

	$real_estate_valuation_enable_animations = get_option( 'real_estate_valuation_enable_animations', true );

    if ( $real_estate_valuation_enable_animations ) {
        //animation
		wp_enqueue_script( 'animate-js', get_theme_file_uri( '/js/animate.js' ), array( 'jquery' ), true );

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


	wp_style_add_data('real-estate-valuation', 'rtl', 'replace');

	wp_enqueue_script('real-estate-valuation-main-script', get_template_directory_uri() . '/js/script.js', array('jquery'), REAL_ESTATE_VALUATION_VERSION, true);

		//font-awesome
	wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/font-awesome/css/all.css', array(), '5.15.3' );
}
add_action( 'wp_enqueue_scripts', 'real_estate_valuation_scripts' );

/**
 * Enqueue admin scripts and styles.
 */
function real_estate_valuation_admin_scripts() {
	$min  = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

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

	$deps = array();

	wp_enqueue_style( 'real-estate-valuation-admin-style', get_stylesheet_directory_uri() . '/css/admin-style.css', $deps, date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) ) );

	wp_enqueue_style(
		'real-estate-valuation-admin-css',
		get_template_directory_uri() . '/notice-getstart/theme-info.css',
		[],
		wp_get_theme()->get( 'Version' )
	);

	// Enqueue JS
	wp_enqueue_script(
		'real-estate-valuation-admin-js',
		get_template_directory_uri() . '/notice-getstart/theme-info.js',
		[],
		wp_get_theme()->get( 'Version' ),
		true // Load in footer
	);
}
add_action( 'admin_enqueue_scripts', 'real_estate_valuation_admin_scripts' );

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


/** 
 * Customizer
 */
require get_template_directory() . '/core/section-pro/customizer.php';


/** 
 * Animation
 */

require get_template_directory() . '/animation-setting.php';



/**
 * Current theme path.
 * Current theme url.
 * Current theme version.
 * Current theme name.
 * Current theme option name.
 */
define( 'REAL_ESTATE_VALUATION_PATH', trailingslashit( get_template_directory() ) );
define( 'REAL_ESTATE_VALUATION_URL', trailingslashit( get_template_directory_uri() ) );
define( 'REAL_ESTATE_VALUATION_VERSION', '1.0.0' );
define( 'REAL_ESTATE_VALUATION_THEME_NAME', 'real-estate-valuation' );
define( 'REAL_ESTATE_VALUATION_OPTION_NAME', 'real-estate-valuation' );

/**
 * The core theme class that is used to define internationalization,
 * admin-specific hooks, and public-facing site hooks.
 */
require REAL_ESTATE_VALUATION_PATH . 'notice-getstart/main.php';


/**
 * Begins execution of the theme.
 *
 * @since    1.0.0
 */
function real_estate_valuation_run() {
	new Real_Estate_Valuation();
}
real_estate_valuation_run();



