<?php

/**
 * azeen functions and definitions
 *
 * For more information on hooks, actions, and filters, @link http://codex.wordpress.org/Plugin_API
 */

/*
 * Set up the content width value based on the theme's design.
 *
 */

 /**
  * Define Constants
  */
 define( 'azeen_THEME_VERSION', '1.0.0' );
 define( 'azeen_THEME_SETTINGS', 'azeen-settings' );

if (! function_exists('azeen_setup')) :
//**************azeen SETUP******************//
function azeen_setup()
{

  // Set the default content width.
	$GLOBALS['content_width'] = 720;

/*
         * Let WordPress manage the document title.
         * By adding theme support, we declare that this theme does not use a
         * hard-coded <title> tag in the document head, and expect WordPress to
         * provide it for us.
         */
    add_theme_support('title-tag');


    // Add default posts and comments RSS feed links to head.
    add_theme_support('automatic-feed-links');

    //Register Menus
    register_nav_menus(array(
        'primary' => __('Primary', 'azeen'),
    ));

    // Declare WooCommerce support
    add_theme_support('woocommerce');

		// Add theme support for woocommerce product gallery added in WooCommerce 3.0.
		add_theme_support( 'wc-product-gallery-lightbox' );
		add_theme_support( 'wc-product-gallery-zoom' );
		add_theme_support( 'wc-product-gallery-slider' );

    //Custom Background
    $args = array(
    'default-color' => 'f7f7f7',
);
    add_theme_support('custom-background', $args);

    /*
         * Switch default core markup for search form, comment form, and comments
         * to output valid HTML5.
         */
    add_theme_support('html5', array(
        'search-form',
        'comment-form',
        'comment-list',
        'gallery',
        'caption',
    ));

    /*
         * Enable support for custom Header image.
         *
         *  @since advance
         */
    $args = array(
            'flex-width'    => true,
            'flex-height'   => true,
            'header-text'   => false,
    );
    add_theme_support('custom-header', $args);

    //Post Thumbnail
    add_theme_support('post-thumbnails');

    // Enables post and comment RSS feed links to head
    add_theme_support('automatic-feed-links');

    // Add theme support for selective refresh for widgets.
    add_theme_support('customize-selective-refresh-widgets');
    /*

    /*
         * Enable support for custom logo.
         *
         *  @since azeen
         */


    $defaults = array(
        'height'      => 100,
        'width'      => 220,
        'flex-width'  => true,
				'flex-height'  => true,
        'header-text' => array( 'site-title', 'site-description' ),
    );
    add_theme_support('custom-logo', $defaults);

    /*
     * Enable support for Post Thumbnails on posts and pages.
     *
     * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
     */
    add_theme_support('post-thumbnails');

    // Add featured image sizes
    //
    // Sizes are optimized and cropped for landscape aspect ratio
    // and optimized for HiDPI displays on 'small' and 'medium' screen sizes.
    add_image_size('azeen-small', 540, 370, true); // name, width, height, crop
    add_image_size('azeen-medium', 750, 450, true);
		add_image_size('azeen-post-layout1', 400, 275, true);
    add_image_size('azeen-large', 1200, 500, true);
    add_image_size('azeen-xlarge', 1920, 600, true);
		add_image_size('azeen-slider', 1440, 500, true);

		if ( class_exists( 'woocommerce' ) ) {
			add_image_size( 'azeen-shop', 300, 300, true );
			add_image_size( 'azeen-shop-2x', 460, 700, true );
		}

}
endif; // azeen_setup
add_action('after_setup_theme', 'azeen_setup');



//Load CSS files

function azeen_scripts()
{
    wp_enqueue_style('fontawesome', get_template_directory_uri() . '/css/fonts/css/font-awesome.min.css', 'font_awesome', true);
    wp_enqueue_style('azeen_core', get_template_directory_uri() . '/css/azeen.min.css', 'azeencore_css', true);
    wp_enqueue_style('azeen-style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'azeen_scripts');



//Load Java Scripts
function azeen_head_js()
{
    if (!is_admin()) {
        wp_enqueue_script('jquery');
        wp_enqueue_script('azeen_js', get_template_directory_uri().'/js/azeen.min.js', array('jquery'), true);
        wp_enqueue_script('azeen_other', get_template_directory_uri().'/js/azeen_other.min.js', array('jquery'), true);

        if (is_singular()) {
            wp_enqueue_script('comment-reply');
        }
    }
}
add_action('wp_enqueue_scripts', 'azeen_head_js');


/**
 * Register widget area.
 *
 * @link http://codex.wordpress.org/Function_Reference/register_sidebar
 */
function azeen_widgets_init()
{

    register_sidebar(array(
    'name'          => __('Sidebar', 'azeen'),
    'id'            => 'right-sidebar',
    'before_widget' => '<div id="%1$s" class="widget %2$s sidebar-item cell small-24 medium-12 large-24"><div class="widget_wrap ">',
    'after_widget'  => '</div></div>',
    'before_title'  => '<div class="widget-title "> <h3>',
    'after_title'   => '</h3></div>'
    ));
		register_sidebar(array(
		'name'          => __('Home widgets area', 'azeen'),
		'id'            => 'home-sidebar',
		'before_widget' => '<div id="%1$s" class="widget %2$s ">',
		'after_widget'  => '</div>',
		'before_title'  => '',
		'after_title'   => ''
		));

    register_sidebar(array(
    'name'          => __('Footer', 'azeen'),
    'id'            => 'foot_sidebar',
    'before_widget' => '<div id="%1$s" class="widget %2$s widget_wrap footer_widgets_warp cell small-24 medium-12 large-auto align-self-top " ><aside id="%1$s" class="widget %2$s">',
    'after_widget'  => '</aside></div>',
    'before_title'  => '<div class="widget-title "> <h3>',
    'after_title'   => '</h3></div>'
    ));
}

add_action('widgets_init', 'azeen_widgets_init');

/**
 * Checks whether woocommerce is active or not
 *
 * @return boolean
 */
function azeen_is_woocommerce_active() {
	if ( class_exists( 'woocommerce' ) ) {
		return true;
	} else {
		return false;
	}
}

/**
 * Checks whether azeen-core is active or not
 *
 * @return boolean
 */
function azeen_is_azeen_core_active() {
	if ( class_exists( 'Azeen_Core' ) ) {
		return true;
	} else {
		return false;
	}
}



require_once(get_template_directory() . '/inc/customizer.php');

/**
 * If woocommerce is active, load compatibility file
 */
if ( azeen_is_woocommerce_active() ) {
	require get_template_directory() . '/inc/woocommerce.php';
}

/** Register all navigation menus */
require_once(get_template_directory() . '/functions/menu.php');

/** Image function */
require_once(get_template_directory() . '/functions/function-hooks.php');

/** Layout function */
require_once(get_template_directory() . '/functions/template-layout.php');

/**
 * Implement the Custom Header feature.
 */
require_once(get_template_directory() . '/inc/custom-header.php');

if ( azeen_is_azeen_core_active() ) {
/** custom css for color */
require_once(get_template_directory() . '/functions/custom-css.php');
}
