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

if ( ! function_exists( 'knowledge_setup' ) ) :
	/**
	 * Loads the child theme textdomain and update notifier.
	 */
	function knowledge_setup() {
	    load_child_theme_textdomain( 'knowledge', get_stylesheet_directory() . '/languages' );
	}
endif;
add_action( 'after_setup_theme', 'knowledge_setup', 11 );

if ( ! function_exists( 'knowledge_scripts' ) ) :
	/**
	 * Enqueue scripts and styles.
	 */
	function knowledge_scripts() {
		$theme_version = wp_get_theme()->get( 'Version' );
		$parent_theme_version = wp_get_theme(get_template())->get( 'Version' );

		/* If using a child theme, auto-load the parent theme style. */
		if ( is_child_theme() ) {
			wp_enqueue_style( 'busyness-style', get_template_directory_uri() . '/style.css', array(), $parent_theme_version );
		}

		/* Always load active theme's style.css. */
		wp_enqueue_style( 'knowledge-style', get_stylesheet_uri(), null, date( 'Ymd-Gis', filemtime( get_stylesheet_directory() . '/style.css' ) ) );
	}
endif;
add_action( 'wp_enqueue_scripts', 'knowledge_scripts' );

/**
 * Main Theme functions
 */
require trailingslashit( get_stylesheet_directory() ) . 'inc/theme-functions.php';

/**
 * Parent theme override functions
 */
require trailingslashit( get_stylesheet_directory() ) . 'inc/override-parent.php';
