Changing the color of post title [closed]

Without all the info of what is actually happening I’m assuming that the title is output with the Song Artist and the Song Name together. But like you said with a dash in the middle.

With that assumption, then you can accomplish this with a custom function that filters the_title before it’s output.

Try putting this in your functions.php file:

function my_title_filter( $title ) {
  // only filter if in the loop and is home page. Edit these accordingly.
  if ( in_the_loop() && is_home() ) { 

    $split_title = explode( ' – ', $title ); // this will split the title into 2 parts. part one before the ' - ' and part 2 after the dash
    // now create the title output format you want
    $new_title="<b>" . $split_title[0] . ' - <strong>' . $split_title[1] . '</strong></b>';

    return $new_title;
  }
  // if not in the loop or home page, then return regular title
  return $title;
}
add_filter( 'the_title', 'my_title_filter', 10, 2 );

Then from there that should format the title like you want… ie.

<b>Song Artist - <strong>Song Name</strong></b>

Although I don’t quite agree with putting a ‘strong’ inside a ‘b’ you can do whatever you want. Personally I’d change the ‘b’ to a ‘strong’ wrapped around the title and then wrap the Song Name in a ‘span’ with a CSS class, and work from there.