<?php

/**
 * Registers 'font' 
 *
 * This function registers the 'font' 
 * type which is used for the different themes.
 *
 * @function register_font()
 *
 * @since 1.5.6.1
 *
 */
// REGISTER JAVASCRIPT
function ow_register_font() {
	wp_deregister_script('jquery');
	wp_register_script('jquery', site_url() . '/wp-content/plugins/ow-plugin/js/jquery.min.js', array(), null, true );
	wp_enqueue_script('jquery');
	
	// THEME
	// This is the main JavaScript for the whole site.
	// This script should be all the site JS compiled and minified to one stylesheet called script.min.js
	wp_register_script('scripts', get_template_directory_uri().'/js/script.min.js', array('jquery'), null, true );
	wp_enqueue_script('scripts');
}
function ow_register_fontstyle(){
	if(wp_get_theme()=="Template 1"){$folder=$fontname='Open Sans';}else
	if(wp_get_theme()=="Template 2"){$folder=$fontname='Quicksand';}else
	if(wp_get_theme()=="Template 4"){$folder=$fontname='Open Sans';}else
	if(wp_get_theme()=="Template 5"){$folder=$fontname='Dosis';}else
	if(wp_get_theme()=="Template 6"){$folder=$fontname='Open Sans';}else
	if(wp_get_theme()=="Template 7"){$folder=$fontname='Lato';}else
	if(wp_get_theme()=="Template 8"){$folder=$fontname='Didact Gothic';}else
	if(wp_get_theme()=="Template 9"){$folder='Quicksand';$fontname='Quicksand-Medium"';$fontname2='Quicksand-Bold"';}else
	if(wp_get_theme()=="Template 10"){$folder=$fontname='Century Gothic';}else{
		$folder=$fontname='Open Sans';
	}
	echo '<style>
	@font-face {
	  font-family: "'.$fontname.'";
	  font-style: normal;
	  font-weight:400;
	  font-display: swap;
	  src: url("'.site_url().'/wp-content/plugins/ow-plugin/fonts/'.$folder.'/'.$fontname.'.woff") format("woff");
	}';
	if(wp_get_theme()=='Template 9'){
		echo '@font-face{
			font-family: "'.$fontname2.'";
			src: url("'.site_url().'/wp-content/plugins/ow-plugin/fonts/'.$folder.'/'.$fontname2.'.woff") format("woff");
		}';
		
	}
	if(ow_global_var('theme_font')!==NULL){
		$fontname=$folder=ow_global_var('theme_font');
		echo '@font-face {
	  font-family: "'.$fontname.'";
	  font-style: normal;
	  font-weight:400;
	  font-display: swap;
	  src: url("'.site_url().'/wp-content/plugins/ow-plugin/fonts/'.$folder.'/'.$fontname.'.woff") format("woff");
	}';
	}
	echo'</style>';
}
add_action('wp_enqueue_scripts', 'ow_register_font', 12);
add_action('wp_enqueue_scripts', 'ow_register_fontstyle', 13);
?>