02-17-2025, 10:51 PM
To set a theme color in your WordPress theme using HTML and meta tags, you can use the following code:
Set Theme Color for Browser UI
Add this <meta> tag inside the <head> section of your WordPress theme (header.php):
Replace #ff6600 with your preferred color code.
This changes the browser's address bar and mobile UI elements to match your theme color in supported browsers (e.g., Chrome on Android).
Adding Theme Color in WordPress via functions.php
If you want to add it dynamically, insert this PHP code in functions.php:
Set Theme Color for Browser UI
Add this <meta> tag inside the <head> section of your WordPress theme (header.php):
PHP Code:
<meta name="theme-color" content="#ff6600">
Replace #ff6600 with your preferred color code.
This changes the browser's address bar and mobile UI elements to match your theme color in supported browsers (e.g., Chrome on Android).
Adding Theme Color in WordPress via functions.php
If you want to add it dynamically, insert this PHP code in functions.php:
Code:
function custom_theme_color() {
echo '<meta name="theme-color" content="#ff6600">';
}
add_action('wp_head', 'custom_theme_color');