Hi, for those that would like to have a slightly fancier website with changing favicons between dark mode and light mode:
function add\_favicon() {
// Light mode favicon
echo ‘<link rel=”icon” type=”image/png” href=”/wp-content/uploads/2023/04/favicondark.png” media=”(prefers-color-scheme: light)”>’;
​
// Dark mode favicon
echo ‘<link rel=”icon” type=”image/png” href=”/wp-content/uploads/2023/04/faviconlight.png” media=”(prefers-color-scheme: dark)”>’;
}
add\_action( ‘wp\_head’, ‘add\_favicon’ );
How to add:
1. login to wp-admin
2. Appearance > Theme File Editor > Functions.php
3. Make sure to change the file paths of href=
Hope it helps, happy to answer any comments or anything related to WordPress on DM’s or comments