<?php


/**
 * DigitalGrove Dark functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @subpackage DigitalGrove Dark
 * @since DigitalGrove Dark 1.0
 */

 if (!function_exists('digitalgrove_dark_support')) :

    /**
     * Sets up theme defaults and registers support for various WordPress features.
     *
     * @since DigitalGrove Dark 1.0.0
     *
     * @return void
     */
    function digitalgrove_dark_support()
    {
        // Add default posts and comments RSS feed links to head.
        add_theme_support('automatic-feed-links');
        add_theme_support('post-thumbnails');        
        //post format support
        add_theme_support( 'post-formats', array('gallery', 'image', 'video', 'audio') );

    }

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

 function digitalgrove_dark_block_assets(){
    // Enqueue theme stylesheet for the front-end.
    wp_enqueue_style( 'digitalgrove-dark-style', get_stylesheet_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );	
	wp_enqueue_script('main-script', get_stylesheet_directory_uri() . '/assets/js/script.js', array('jquery'), '1.0.0', true);
}

add_action('enqueue_block_assets', 'digitalgrove_dark_block_assets');

// register own theme pattern

function digitalgrove_dark_register_pattern_category() {

	$patterns = array();

	$block_pattern_categories = array(
		'digitalgrove-dark' => array( 'label' => __( 'DigitalGrove Dark', 'digitalgrove-dark' ) )
	);

	$block_pattern_categories = apply_filters( 'digitalgrove_dark_block_pattern_categories', $block_pattern_categories );

	foreach ( $block_pattern_categories as $name => $properties ) {
		if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
			register_block_pattern_category( $name, $properties );
		}
	}
}

add_action( 'init', 'digitalgrove_dark_register_pattern_category');