Advertisement
cipher87

Untitled

Dec 19th, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.01 KB | None | 0 0
  1. function avia_logo( $use_image = '', $sub = '', $headline_type = 'h1', $dimension = '' )
  2. {
  3.     $headline_type  = apply_filters( 'avf_logo_headline', $headline_type );
  4.     $sub            = apply_filters( 'avf_logo_subtext',  $sub );
  5.     $alt            = apply_filters( 'avf_logo_alt', get_bloginfo( 'name' ) );
  6.     $link           = apply_filters( 'avf_logo_link', home_url( '/' ) );
  7.     $title          = '';
  8.    
  9.     if( $sub )
  10.     {
  11.         $sub = "<span class='subtext'>{$sub}</span>";
  12.     }
  13.    
  14.     if( $dimension === true )
  15.     {
  16.         $dimension = "height='100' width='300'"; //basically just for better page speed ranking :P
  17.     }
  18.  
  19.     $logo = avia_get_option( 'logo' );
  20.     if( ! empty( $logo ) )
  21.     {
  22.         $logo = apply_filters( 'avf_logo', $logo, 'option_set' );
  23.         if( is_numeric( $logo ) )
  24.         {
  25.             $logo_id = $logo;
  26.             $logo = wp_get_attachment_image_src( $logo_id, 'full' );
  27.             if( is_array( $logo ) )
  28.             {
  29.                 $logo = $logo[0];
  30.                 $title = get_the_title( $logo_id );
  31.             }
  32.         }
  33.            
  34.         $title = apply_filters( 'avf_logo_title', $title, 'option_set' );
  35.  
  36.         $logo = "<img {$dimension} src='{$logo}' alt='{$alt}' title='{$title}' />";
  37.         $logo = "<{$headline_type} class='logo'><a href='{$link}'>{$logo}{$sub}</a></{$headline_type}>";
  38.     }
  39.     else
  40.     {
  41.         $logo = get_bloginfo('name');
  42.         $use_image = apply_filters( 'avf_logo', $use_image, 'option_not_set' );
  43.        
  44.         $use_image = '';
  45.         if( ! empty( $use_image ) )
  46.         {
  47.             $title = apply_filters( 'avf_logo_title', $logo, 'option_not_set' );
  48.             $logo = "<img {$dimension} src='{$use_image}' alt='{$alt}' title='{$title}'/>";
  49.         }
  50.        
  51.         $logo = "<{$headline_type} class='logo bg-logo'><a href='{$link}'>{$logo}{$sub}</a></{$headline_type}>";
  52.     }
  53.    
  54.     $logo = apply_filters( 'avf_logo_final_output', $logo, $use_image, $headline_type, $sub, $alt, $link, $title );
  55.  
  56.     return $logo;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement