
header-logo.php
By: a guest on
Aug 8th, 2012 | syntax:
PHP | size: 1.72 KB | hits: 28 | expires: Never
<?php
/*
* Determines how to display the logo (custom logo, text, etc)
*
* @package WordPress
* @subpackage Leap
* @since Leap 1.0
*/
//these globals are set in header.php
global $link_color, $color_scheme;
$site_title = get_bloginfo('name');
$site_url = home_url();
$logo_url = '';
$custom_logo = get_option_tree('custom_logo');
if(get_option_tree('disable_image_logo') != 'Disable') :
if($custom_logo == '') {
switch($color_scheme) {
//use default "Leap" logo, based on color scheme selected
case 'dark':
$logo_url = get_template_directory_uri() . '/images/dark/leap_logo_'. strtolower($link_color) .'.png';
break;
default:
$logo_url = get_template_directory_uri() . '/images/leap_logo_'. strtolower($link_color) .'.png';
break;
}
}else{
//use custom logo uploaded by user
$logo_url = $custom_logo;
}
//determine image width and height
$imageURL = $_SERVER['DOCUMENT_ROOT'] . strstr(preg_replace("/http(s)?:\/\//", "", get_bloginfo('siteurl')), "/") . str_replace(get_bloginfo('siteurl'), "", $logo_url);
list($width, $height, $type, $attr) = getimagesize($imageURL);
?>
<h1 style="background:url(<?php print($logo_url); ?>); width:<?php print($width); ?>px; height:<?php print($height); ?>px;"><a href="<?php print($site_url); ?>"><?php print($site_title); ?></a></h1>
<!-- this image is used for mobile -->
<div style="width: <?php print($width); ?>px">
<a href="<?php print($site_url); ?>"><img src="<?php print($logo_url); ?>" alt="<?php print($site_title); ?>" class="logo" /></a>
</div>
<?php else: ?>
<!-- logo is disabled -->
<h1 class="logo_disabled"><a href="<?php print($site_url); ?>"><?php print($site_title); ?></a></h1>
<?php endif; ?>