Don't like ads? PRO users don't see any ads ;-)
Guest

header-logo.php

By: a guest on Aug 8th, 2012  |  syntax: PHP  |  size: 1.72 KB  |  hits: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. /*
  4. * Determines how to display the logo (custom logo, text, etc)
  5. *
  6. * @package WordPress
  7. * @subpackage Leap
  8. * @since Leap 1.0
  9. */
  10.  
  11. //these globals are set in header.php
  12. global $link_color, $color_scheme;
  13.  
  14. $site_title  = get_bloginfo('name');
  15. $site_url        = home_url();
  16. $logo_url        = '';
  17. $custom_logo = get_option_tree('custom_logo');
  18.  
  19. if(get_option_tree('disable_image_logo') != 'Disable') :
  20.         if($custom_logo == '') {
  21.                 switch($color_scheme) {
  22.                         //use default "Leap" logo, based on color scheme selected
  23.                         case 'dark':
  24.                                 $logo_url = get_template_directory_uri() . '/images/dark/leap_logo_'. strtolower($link_color) .'.png';
  25.                                 break;
  26.  
  27.                         default:
  28.                                 $logo_url = get_template_directory_uri() . '/images/leap_logo_'. strtolower($link_color) .'.png';
  29.                                 break;
  30.                 }
  31.                
  32.         }else{
  33.                 //use custom logo uploaded by user
  34.                 $logo_url = $custom_logo;
  35.         }
  36.  
  37.         //determine image width and height
  38.         $imageURL = $_SERVER['DOCUMENT_ROOT'] . strstr(preg_replace("/http(s)?:\/\//", "", get_bloginfo('siteurl')), "/") . str_replace(get_bloginfo('siteurl'), "", $logo_url);
  39. list($width, $height, $type, $attr) = getimagesize($imageURL); 
  40.  
  41. ?>
  42.  
  43. <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>
  44.  
  45. <!-- this image is used for mobile -->
  46. <div style="width: <?php print($width); ?>px">
  47.         <a href="<?php print($site_url); ?>"><img src="<?php print($logo_url); ?>" alt="<?php print($site_title); ?>" class="logo" /></a>
  48. </div>
  49.  
  50. <?php else: ?>
  51.         <!-- logo is disabled -->
  52.         <h1 class="logo_disabled"><a href="<?php print($site_url); ?>"><?php print($site_title); ?></a></h1>
  53. <?php endif; ?>