<?php
/*
 * Global theme related settings
 */

if(!function_exists('trainify_framework_after_setup_theme')):

	function trainify_framework_after_setup_theme(){

		add_image_size( 'trainify-framework-thumb-400x300', 400, 300, true );

	}

endif;
add_action( 'after_setup_theme', 'trainify_framework_after_setup_theme' );

/*
 * Enqueue Scripts and Styles
 */

if(!function_exists('trainify_framework_admin_enqueue_scripts') ):

	function trainify_framework_admin_enqueue_scripts(){

		wp_enqueue_style('wp-color-picker');
		wp_enqueue_script('wp-color-picker');

		wp_enqueue_style( 'tff-admin-styles', trainify_framework_assets_url('css/tff-admin-styles.min.css'), array(), '1.0.0');
		wp_enqueue_style( 'font-awesome', trainify_framework_assets_url('library/font-awesome/css/font-awesome.min.css'), array(), '1.0.0');

		wp_enqueue_script('tff-admin-script', trainify_framework_assets_url('js/tff-admin-script.min.js'), array('jquery'), '1.0.0', true);

	}

endif;

add_action('admin_enqueue_scripts', 'trainify_framework_admin_enqueue_scripts');

if(!function_exists('trainify_framework_front_enqueue_scripts') ):

	function trainify_framework_front_enqueue_scripts(){

		wp_enqueue_style( 'font-awesome', trainify_framework_assets_url('library/font-awesome/css/font-awesome.min.css'), array(), '1.0.0');
		wp_enqueue_style( 'tff-front-style', trainify_framework_assets_url('css/tff-front-style.min.css'), array(), '1.0.0' );

		wp_enqueue_script('tff-front-script', trainify_framework_assets_url('js/tff-front-script.min.js'), array('jquery'), '1.0.0', true);
		
		if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
			wp_enqueue_script( 'comment-reply' );
		}

	}

endif;
add_action('wp_enqueue_scripts', 'trainify_framework_front_enqueue_scripts');


$filter_name = 'upload_mimes';
/**
 * custom mimes upload
 */
if(!function_exists('trainify_custom_upload_mimes')):

	function trainify_custom_upload_mimes($mimes = array()) {

    // Add a key and value for the CSV file type
		$mimes['csv'] = "text/csv";
		return $mimes;
	}

endif;

add_filter( $filter_name, 'trainify_custom_upload_mimes');
