<?php
// error_reporting(E_ALL & ~(E_STRICT|E_NOTICE|E_WARNING|E_DEPRECATED));
// ini_set("display_errors", 1);

if ( function_exists( 'siteSelfURL' ) ) {
   	$currentUrl = siteSelfURL(false,false);//=== get the site url ====
   	$isLoginPage = strpos($currentUrl, 'wp-login.php', 0);
   	if (!$isLoginPage) {
   		//====================== set the individual site css=================================
   		$cssPaths['variationPath']='';
   		$cssPaths['siteCssPath']='';		
   		extractDomainName($currentUrl,$cssPaths['variationPath'],$cssPaths['siteCssPath']);
   		if($cssPaths['variationPath']!== "no record found"){
   			//=== this loads the css ===
   			loadCss($cssPaths);	
   			//===set individual site custom functions ==================================================================
   			$tplFileName = $cssPaths['siteCssPath'].'_functions.php';
   			if ((!empty($tplFileName)) && (is_readable($tplFileName))) {
   				require($tplFileName);//=== this loads the functions ===
   			}else{
   				if (!is_admin()){
					echo '<div> skin code not available </div>';
				} 
   			}
   		}
   	}
}
//====================== load template for single posts and archives =================================
function filter_single_templates( $template ) {
	$postTplFileName = WP_CONTENT_DIR.'\\themes\\skins\\tpl_post.php';
	$archiveTplFileName = WP_CONTENT_DIR.'\\themes\\skins\\tpl_archive.php';
	if(is_single()){
		if ((!empty($postTplFileName)) && (is_readable($postTplFileName))) {
			return $postTplFileName;
		}
	}else{
		if ((!empty($archiveTplFileName)) && (is_readable($archiveTplFileName))) {
			return $archiveTplFileName;
		}
	}
	return $template;
}
add_filter( 'single_template', 'filter_single_templates');
add_filter( 'category_template', 'filter_single_templates');
// add_filter( 'taxonomy_template', 'filter_single_templates');
// add_filter( 'tag_template', 'filter_single_templates');
// add_filter( 'graceful_fail_template', 'filter_single_templates');
add_filter( 'author_template', 'filter_single_templates');
add_filter( 'achive_template', 'filter_single_templates');
//======================end of  load template for single posts and archives =================================


//.............................................................................
//	CUSTOM FOOTER: VERTICAL WIDE
//.............................................................................

function footer_vertical() {
?>
	<div id="footer-bottom">
		<p>&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?> | All Rights Reserved</p>
		<p id="bottom-line"><a href="http://www.dwdining.com/" title="Link to the Dennison+Wolfe Dining Platform home page." target="_blank">Restaurant web design</a> by D+W Dining, a <a href="http://www.dennisonwolfe.com" title="Link to the Dennison+Wolfe home page." target="_blank">Dennison+Wolfe</a> platform.</p> 
	</div>

<?php }

remove_action('thesis_hook_footer', 'thesis_attribution');
add_action('thesis_hook_after_footer', 'footer_vertical');


//.............................................................................
//	CUSTOM LOGIN INFORMATION	

function custom_login() { 
	echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/custom/custom-login/custom-login.css" />'; 
}
add_action('login_head', 'custom_login');
