<?php
if ( ! defined( 'TRANSPORT_CARRIER_VERSION' ) ) {
	define( 'TRANSPORT_CARRIER_VERSION', '0.0.1' );
}

/**
 * Enqueue scripts and styles.
 */
function transport_carrier_scripts() {
	wp_enqueue_style( 'transport-carrier-style', trailingslashit( get_template_directory_uri() ) . 'assets/css/style.css', array(), TRANSPORT_CARRIER_VERSION );

	wp_enqueue_style( 'fontawesome', trailingslashit( get_template_directory_uri() ) . 'assets/css/font-awesome/css/all.css', array(), TRANSPORT_CARRIER_VERSION );

	wp_enqueue_style( 'owl-carousel-css', trailingslashit( get_template_directory_uri() ) . 'assets/css/owl.carousel.css', array(), TRANSPORT_CARRIER_VERSION );

	// Enqueue theme JavaScript
	wp_enqueue_script( 'transport-carrier-theme', trailingslashit( get_template_directory_uri() ) . 'assets/js/theme.js',
	    array( 'jquery' ), TRANSPORT_CARRIER_VERSION,true );

	wp_enqueue_script( 'owl-carousel-js', get_theme_file_uri( '/assets/js/owl.carousel.js' ), array( 'jquery' ), true );

}
add_action( 'wp_enqueue_scripts', 'transport_carrier_scripts' );

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

/**
 * Enqueue Editor styles.
 */
function transport_carrier_enqueue_editor_block_styles() {
	// Enqueue editor styles.
	add_editor_style( trailingslashit( get_template_directory_uri() ) . 'assets/css/editor-style.css' );
}
add_action( 'after_setup_theme', 'transport_carrier_enqueue_editor_block_styles' );

/**
 * Pattern categories.
 */
function transport_carrier_register_block_pattern_category() {
	register_block_pattern_category(
		'transport-carrier-banner',
		array(
			'label' => esc_html__( 'Banner', 'transport-carrier' ),
		)
	);
	
	register_block_pattern_category(
		'transport-carrier-services',
		array(
			'label' => esc_html__( 'Services', 'transport-carrier' ),
		)
	);
}
add_action( 'init', 'transport_carrier_register_block_pattern_category' );

/**
 * Add theme support for various features.
 */
function transport_carrier_setup() {

	load_theme_textdomain( 'transport-carrier', get_template_directory() . '/languages' );

	// 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', 'transport_carrier_setup' );

/**
 * Upgrade to Pro
 */
$transport_carrier_pro_customize = trailingslashit( get_template_directory() ) . 'transport-carrier-pro/class-customize.php';
if ( file_exists( $transport_carrier_pro_customize ) ) {
    require_once $transport_carrier_pro_customize;
}

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

/**getstart*/
$transport_carrier_theme_info = get_template_directory() . '/transport-carrier-get-theme-info.php';
if ( file_exists( $transport_carrier_theme_info ) ) {
    require $transport_carrier_theme_info;
}

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