Created
January 5, 2019 09:50
-
-
Save Tsunamijaan/6388cea8fd875c71e1c53b03427882c9 to your computer and use it in GitHub Desktop.
How to add favicon in wordpress website?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make sure you used this before </head> | |
If you have favicon as .ico format, you can use this code. | |
<link type="image/x-icon" rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/img/favicon.ico"> | |
If you have favicon as png image format, you can use this code. Make sure your favicon size is 16x16px | |
<link rel="shortcut icon" type="image/png" href="<?php echo get_template_directory_uri(); ?>/img/favicon.png"/> | |
You can register favicon via functions.php too. See this code | |
function my_theme_add_favicon(){ ?> | |
<!-- Custom Favicons --> | |
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri();?>/img/favicon.ico"/> | |
<?php } | |
add_action('wp_head','my_theme_add_favicon'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment