Advertisement
pratikshrestha

Catch Responsive make Logo link PLL compatible

Jun 27th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.13 KB | None | 0 0
  1. /**
  2.  * Get the logo and display
  3.  *
  4.  * @uses get_transient, catchresponsive_get_theme_options, get_header_textcolor, get_bloginfo, set_transient, display_header_text
  5.  * @get logo from options and make it polylang compatible
  6.  *
  7.  * @display logo
  8.  *
  9.  * @action
  10.  *
  11.  * @since Catch Responsive 1.0
  12.  */
  13. function catchresponsive_site_branding() {
  14.     $options            = catchresponsive_get_theme_options();
  15.  
  16.     $catchresponsive_site_logo = '';
  17.     //Checking Logo
  18.     if ( function_exists( 'has_custom_logo' ) ) {
  19.         if ( has_custom_logo() ) {
  20.             $custom_logo_id = get_theme_mod( 'custom_logo' );
  21.             $image          = wp_get_attachment_image_src( $custom_logo_id , 'full' );
  22.  
  23.             $catchresponsive_site_logo = '
  24.             <div id="site-logo">
  25.                 <a href="' . esc_url( pll_home_url() ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" rel="home">
  26.                     <img src="' . esc_url( $image ) . '" alt="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '">
  27.                 </a>
  28.             </div><!-- #site-logo -->';
  29.  
  30.         }
  31.     }
  32.     else if ( '' != $options['logo'] && !$options['logo_disable'] ) {
  33.         $catchresponsive_site_logo = '
  34.         <div id="site-logo">
  35.             <a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" rel="home">
  36.                 <img src="' . esc_url( $options['logo'] ) . '" alt="' . esc_attr(  $options['logo_alt_text'] ). '">
  37.             </a>
  38.         </div><!-- #site-logo -->';
  39.     }
  40.  
  41.     $catchresponsive_header_text = '
  42.     <div id="site-header">
  43.         <h1 class="site-title"><a href="' . esc_url( home_url( '/' ) ) . '">' . get_bloginfo( 'name' ) . '</a></h1>
  44.         <h2 class="site-description">' . get_bloginfo( 'description' ) . '</h2>
  45.     </div><!-- #site-header -->';
  46.  
  47.  
  48.     $text_color = get_header_textcolor();
  49.  
  50.     $catchresponsive_site_branding  = '<div id="site-branding">';
  51.     $catchresponsive_site_branding  .= $catchresponsive_header_text;
  52.  
  53.     if ( function_exists( 'has_custom_logo' ) ) {
  54.         if ( has_custom_logo() ) {
  55.             if ( ! $options['move_title_tagline'] && 'blank' != $text_color ) {
  56.                 $catchresponsive_site_branding  = '<div id="site-branding" class="logo-left">';
  57.                 $catchresponsive_site_branding .= $catchresponsive_site_logo;
  58.                 $catchresponsive_site_branding .= $catchresponsive_header_text;
  59.             }
  60.             else {
  61.                 $catchresponsive_site_branding  = '<div id="site-branding" class="logo-right">';
  62.                 $catchresponsive_site_branding .= $catchresponsive_header_text;
  63.                 $catchresponsive_site_branding .= $catchresponsive_site_logo;
  64.             }
  65.         }
  66.     }
  67.     else if ( '' != $options['logo'] && !$options['logo_disable'] ) {
  68.         if ( ! $options['move_title_tagline'] && 'blank' != $text_color ) {
  69.             $catchresponsive_site_branding  = '<div id="site-branding" class="logo-left">';
  70.             $catchresponsive_site_branding .= $catchresponsive_site_logo;
  71.             $catchresponsive_site_branding .= $catchresponsive_header_text;
  72.         }
  73.         else {
  74.             $catchresponsive_site_branding  = '<div id="site-branding" class="logo-right">';
  75.             $catchresponsive_site_branding .= $catchresponsive_header_text;
  76.             $catchresponsive_site_branding .= $catchresponsive_site_logo;
  77.         }
  78.     }
  79.  
  80.     $catchresponsive_site_branding  .= '</div><!-- #site-branding-->';
  81.  
  82.     echo $catchresponsive_site_branding ;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement