The custom header feature allows the user to set the color of the header text. But what if you’d like for the site title to be a different color than the site tagline? This is an issue I just hit in the GovPress theme I’ve been working on.
To solve it I added an additional option to the theme customizer:
In my inline styles, I output the color option:
Escaping the color option output
Kirk Wright and Zach Tollman both mentioned escaping the output of the the color option in the comments below, so I’ve updated the above code snippet to include sanitize_hex_color. However, this function isn’t available when the theme customizer isn’t loaded- so that will also need to be added to your code:
Post Message Support
I also have postMessage support so the updated colors appear instantly, but I’ll let you pick through the code if you’d like to update that.
Check out this code (with additional options as well) on GitHub: