<?php
/**
 * Register of theme features on after_setup_hook
 * @since 1.0
 * @package evaWp
 */
function evawp_after_theme_setup(){
	/* Add theme support for Custom Logo. */
	$custom_logo_args = array(
		'width'       => 180,
		'height'      => 60,
		'flex-width'  => true,
		'flex-height' => true,
	);
	add_theme_support( 'custom-logo', $custom_logo_args	);

	/* Switch default core markup for search form, comment form, and comments.
		to output valid HTML5.
	*/
	$html5_args = array(
		'search-form',
		'comment-form',
		'comment-list',
		'gallery',
		'caption',
	);
	add_theme_support( 'html5', $html5_args );

	/* Gutenberg wide images. */
	add_theme_support( 'align-wide' );
	add_theme_support( 'wp-block-styles' );
	/* Add default posts and comments RSS feed links to head. */
	add_theme_support( 'automatic-feed-links' );

	/* Let WordPress manage the document title. */
	add_theme_support( 'title-tag' );

	/* Enable support for Post Thumbnails on posts and pages. */
	add_theme_support( 'post-thumbnails' );

	/* Add theme support for selective refresh for widgets. */
	add_theme_support( 'customize-selective-refresh-widgets' );

	/* Post formats. */
	add_theme_support(
		'post-formats',
		array(
			'gallery',
			'image',
			'link',
			'quote',
			'video',
			'audio',
			'status',
			'aside',
		)
	);

	add_theme_support( 'responsive-embeds' );

	# Set up the WordPress core custom background feature.
	add_theme_support( 'custom-background', apply_filters(  'evawp_custom_background_args', array(
		'default-color' => 'ffffff'
	) ) );


	/* Customize Selective Refresh Widgets. */
	add_theme_support( 'customize-selective-refresh-widgets' );
	add_theme_support( 'post-thumbnails' );

	/**
	 * This variable is intended to be overruled from themes.
	 * Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
	 * phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
	 */			
	$GLOBALS['content_width'] = apply_filters( 'content_width_setup', 640 );

	/**
	 * Make theme available for translation.
	 * Translations can be filed in the /languages/ directory.
	 */
	load_theme_textdomain( 'evewp', get_theme_file_uri( 'languages' ) );
	/**
	* Register Menus
	* @since 1.0
	* @package evaWp
	*/
	register_nav_menus(
		array(
			'primary-menu' => esc_html__( 'Primary Menu', 'evawp' ),
			'social-menu-header' => esc_html__( 'Social Menu Header', 'evawp' )
		)
	);

	# header image options
	add_theme_support( 'custom-header', apply_filters( 'evawp_header_media_args' , array(
		'default-text-color' => '000000',
		'width'              => 1366,
		'height'             => 400,
		'flex-height'        => true,
		'default-image'      => '',
	)));

	/**
	 * Support to new page template wp 5.8
	 */
	add_theme_support( 'block-templates' );
}
add_action( 'after_setup_theme', 'evawp_after_theme_setup' );