Skip to content

Instantly share code, notes, and snippets.

@jasontucker
Forked from billerickson/gist:1325515
Last active December 10, 2015 22:38
Show Gist options
  • Save jasontucker/4504080 to your computer and use it in GitHub Desktop.
Save jasontucker/4504080 to your computer and use it in GitHub Desktop.
Bill's code resulted in having the <span></span> be included in the id="title" which was problematic for the site I as working on my method breaks up the title a bit more to not including the <span></span> in the title attribute.
<?php
/**
* Set a span around the letters "WP" in Site Title
* @author Jason Tucker
* Based on code by Bill Erickson
*
* Why fork?
* Bill's code resulted in having the <span></span>
* be included in the id="title" which was problematic
* for the site I as working on my method breaks up the
* title a bit more to not including the <span></span>
* in the title attribute.
*
* @param string $title full title
* @param string $inside text
* @param string $wrap html wrapper
* @return string full title
*/
function jt_customize_site_title($title, $inside, $wrap) {
$site_title = get_bloginfo( 'name' );
$custom = str_replace('WP', '<span>WP</span>', $site_title);
$title = sprintf( '<h1 id="title"><a href="%s" title="%s">%s</a></h1>', trailingslashit( home_url() ), $site_title,$custom);
return $title;
}
add_filter('genesis_seo_title','jt_customize_site_title', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment