<?php
if ( ! defined( 'LEGACY_REAL_ESTATE_VERSION' ) ) {
	define( 'LEGACY_REAL_ESTATE_VERSION', '1.0.5' );
}

/**
 * Enqueue scripts and styles.
 */
function legacy_real_estate_scripts() {
	wp_enqueue_style( 'legacy-real-estate-style', trailingslashit( get_template_directory_uri() ) . 'assets/css/style.css', array(), LEGACY_REAL_ESTATE_VERSION );

	wp_style_add_data( 'legacy-real-estate-style', 'rtl', 'replace' );

	wp_enqueue_style( 'legacy-real-estate-fontawesome', trailingslashit( get_template_directory_uri() ) . 'assets/css/font-awesome/css/all.css', array(), LEGACY_REAL_ESTATE_VERSION );
	
	// Enqueue theme JavaScript
	wp_enqueue_script( 'legacy-real-estate-theme', trailingslashit( get_template_directory_uri() ) . 'assets/js/theme.js', array(), LEGACY_REAL_ESTATE_VERSION, true );
}
add_action( 'wp_enqueue_scripts', 'legacy_real_estate_scripts' );

function legacy_beauty_center_load_dashicons_front_end() {
    wp_enqueue_style( 'dashicons' );
}
add_action( 'wp_enqueue_scripts', 'legacy_beauty_center_load_dashicons_front_end' );

/**
 * Enqueue Editor styles.
 */
function legacy_real_estate_enqueue_editor_block_styles() {
	// Disable Core Block Patterns.
	remove_theme_support( 'core-block-patterns' );
	// Enqueue editor styles.
	add_editor_style( trailingslashit( get_template_directory_uri() ) . 'assets/css/editor-style.css' );
}
add_action( 'after_setup_theme', 'legacy_real_estate_enqueue_editor_block_styles' );

/**
 * Pattern categories.
 */
function legacy_real_estate_register_block_pattern_category() {
	register_block_pattern_category(
		'banner',
		array(
			'label' => esc_html__( 'Banner', 'legacy-real-estate' ),
		)
	);
	
	register_block_pattern_category(
		'properties',
		array(
			'label' => esc_html__( 'Properties', 'legacy-real-estate' ),
		)
	);
}
add_action( 'init', 'legacy_real_estate_register_block_pattern_category' );

/**
 * Add theme support for various features.
 */
function legacy_real_estate_setup() {
	// Add support for block styles.
	add_theme_support( 'wp-block-styles' );
	
	// Add support for editor styles.
	add_theme_support( 'editor-styles' );
	
	// Add support for responsive embedded content.
	add_theme_support( 'responsive-embeds' );
}
add_action( 'after_setup_theme', 'legacy_real_estate_setup' );

/**
 * TGM Recommendation
 */
require get_parent_theme_file_path( '/TGM/tgm.php' );

/**
 * Upgrade to Pro
 */
require_once( trailingslashit( get_template_directory() ) . 'legacy-real-estate-pro/class-customize.php' );

/**
 * Notices
 */
require_once get_parent_theme_file_path( '/activation-notice/class-welcome-notice.php' );

/**getstart*/
require get_template_directory() . '/legacy-real-estate-get-theme-info.php';

if ( ! function_exists( 'legacy_real_estate_admin_scripts' ) ) :
    function legacy_real_estate_admin_scripts($hook) {
        wp_enqueue_style( 'legacy-real-estate-get-theme-info-css', get_template_directory_uri() . '/assets/css/legacy-real-estate-get-theme-info.css', false ); 
    }
endif;
add_action( 'admin_enqueue_scripts', 'legacy_real_estate_admin_scripts' );