Advertisement
srikat

Untitled

Feb 23rd, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.74 KB | None | 0 0
  1. /**********************************
  2.  *
  3.  * Replace Header Site Title with Inline Logo
  4.  *
  5.  * Fixes Genesis bug - when using static front page and blog page (admin reading settings) Home page is <p> tag and Blog page is <h1> tag
  6.  *
  7.  * Replaces "is_home" with "is_front_page" to correctly display Home page wit <h1> tag and Blog page with <p> tag
  8.  *
  9.  * @author AlphaBlossom / Tony Eppright
  10.  * @link http://www.alphablossom.com/a-better-wordpress-genesis-responsive-logo-header/
  11.  *
  12.  * @edited by Sridhar Katakam
  13.  * @link http://www.sridharkatakam.com/use-inline-logo-instead-background-image-genesis/
  14.  *
  15. ************************************/
  16. add_filter( 'genesis_seo_title', 'custom_header_inline_logo', 10, 3 );
  17. function custom_header_inline_logo( $title, $inside, $wrap ) {
  18.  
  19.     $logo = '<img src="' . get_stylesheet_directory_uri() . '/images/logo.png" alt="' . esc_attr( get_bloginfo( 'name' ) ) . '" title="' . esc_attr( get_bloginfo( 'name' ) ) . '" width="380" height="90" />';
  20.  
  21.     $inside = sprintf( '<a href="%s" title="%s">%s</a>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), $logo );
  22.  
  23.     //* Determine which wrapping tags to use - changed is_home to is_front_page to fix Genesis bug
  24.     $wrap = is_front_page() && 'title' === genesis_get_seo_option( 'home_h1_on' ) ? 'h1' : 'p';
  25.  
  26.     //* A little fallback, in case an SEO plugin is active - changed is_home to is_front_page to fix Genesis bug
  27.     $wrap = is_front_page() && ! genesis_get_seo_option( 'home_h1_on' ) ? 'h1' : $wrap;
  28.  
  29.     //* And finally, $wrap in h1 if HTML5 & semantic headings enabled
  30.     $wrap = genesis_html5() && genesis_get_seo_option( 'semantic_headings' ) ? 'h1' : $wrap;
  31.  
  32.     return sprintf( '<%1$s %2$s>%3$s</%1$s>', $wrap, genesis_attr( 'site-title' ), $inside );
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement