<?php

namespace GemBoards\Frontend;

use GemBoards\Utils\Helper;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Template {
	public static function init() {
		$self = new self();
		add_filter( 'template_include', array( $self, 'template_include' ) );
	}

	public function template_include( $template ) {
		$route = get_query_var( 'gemboards_app_route' );
		if ( Helper::get_settings( 'load_on_entire_site', false ) || ! empty( $route ) ) {
			return GEMBOARDS_TEMPLATES_DIR_PATH . 'app.php';
		}

		return $template;
	}
}
