<?php
/**
 * Setup.
 *
 * @package MadeByAura\Prime\Hooks
 * @author  MadeByAura.com
 */

namespace MadeByAura\Prime\Hooks;

use MadeByAura\Prime\Base;
use MadeByAura\Prime\Helpers\SingletonTrait;

defined( 'ABSPATH' ) || die();

/**
 * Setup.
 */
class Setup {
	use SingletonTrait;

	/**
	 * Constructor.
	 */
	protected function __construct() {
		add_action( 'after_setup_theme', [ __CLASS__, 'theme_setup' ] );
	}

	/**
	 * Theme setup.
	 */
	public static function theme_setup() {
		// Load theme textdomain.
		load_theme_textdomain( 'aura-prime', Base::get_info( 'path' ) . 'languages' );

		// Load the framework textdomain.
		load_textdomain( 'aura-wp', '' );

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

		// Switch default core markup to output valid HTML5.
		add_theme_support( 'html5', [ 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ] );

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

		// Register custom image sizes.
		add_image_size( 'aura_thumbnail', 465, 310, true ); // width / 1.5 = height.
		add_image_size( 'aura_banner', 980, 445, true ); // width / 2.2 = height.
		add_image_size( 'aura_content', 980, 0 );

		// Set the content width in pixels, based on the theme's design and stylesheet.
		$GLOBALS['content_width'] = apply_filters( 'aura_theme_content_width', 1400 );
	}
}
