Scenario: In the Header section of Genesis Theme Settings, Dynamic text is set to be shown for site title.
This will pull the Site Title text entered in Settings > General and display it in .site-header. There could be times when you want to use different text instead of the site title or use HTML instead of a string of unformatted text. Note that HTML entered in Site Title field in WordPress settings page will not be parsed and displayed as is.
genesis_seo_title filter in Genesis can be used to replace the standard Site Title text with your custom content.
Ex.:
Adding
<?php | |
//* Do NOT include the opening php tag | |
add_filter( 'genesis_seo_title', 'custom_genesis_seo_title', 10, 1 ); | |
/** | |
* Replace Site Title text entered in Settings > Reading with custom HTML. | |
* @author Sridhar Katakam | |
* @link http://sridharkatakam.com/replace-site-title-text-custom-html-genesis/ | |
* | |
* @param string original title text | |
* @return string modified title HTML | |
*/ | |
function custom_genesis_seo_title( $title ) { | |
$title = '<h1 itemprop="headline" class="site-title"><a title="Homepage" href="' . get_bloginfo('url') . '">Custom <span style="color: #0f709e">HTML</span> here</a></h1>'; | |
return $title; | |
} |
in child theme’s functions.php
results in