Last active
June 13, 2018 02:56
-
-
Save cdils/9002451 to your computer and use it in GitHub Desktop.
Filter the Genesis SEO Title to output with a custom class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Filter the title with a custom function | |
add_filter('genesis_seo_title', 'wap_site_title' ); | |
// Add additional custom style to site header | |
function wap_site_title( $title ) { | |
// Change $custom_title text as you wish | |
$custom_title = '<span class="custom-title">WA</span>Estate'; | |
// Don't change the rest of this on down | |
// If we're on the front page or home page, use `h1` heading, otherwise us a `p` tag | |
$tag = ( is_home() || is_front_page() ) ? 'h1' : 'p'; | |
// Compose link with title | |
$inside = sprintf( '<a href="%s" title="%s">%s</a>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), $custom_title ); | |
// Wrap link and title in semantic markup | |
$title = sprintf ( '<%s class="site-title" itemprop="headline">%s</%s>', $tag, $inside, $tag ); | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment