Hello @declanmaherry,
First off all add below code into your function.php which is in Appearance >Editor > function.php (In right).
/**
* Add the <span>...</span> tag to the first word of the blog title.
*/
add_filter( 'body_class', function( $class ){
add_filter( 'bloginfo', 'change_first_word_color', 10, 2 );
return $class;
});
function change_first_word_color( $output, $show ){
static $count = 0;
//This will target the "name" part.:
if( 'name' === $show ) {
// Target the second representative:
if( 2 === ++$count ){
remove_filter( current_filter(), _FUNCTION_ );
// Change the color of first word.:
$first_title = explode( ' ', $output );
if( count( $first_title ) > 0 ){
$first_title[0] = sprintf( '<span>%s</span>', $first_title[0] );
}
$output = join( ' ', $first_title );
}
}
return $output;
}
And add this CSS into your stylesheet of the currently active theme.
h1.site-title span{
color: #000; /*add your dresire color here.*/
}
Hope this will helps you.
Thanks.
Thank you so much!
I am a little confused about two things though;
1. Which parts of the code do I need to populate with the actual text – if any? (eg. $first_title = $ISO (the first word in the title))
2. Do i need to paste the code into a specific place within the function and style sheets? There are several sections dealing with the title.
Thanks in advance
Declan