-
-
Save mayeenulislam/312bfefcdb008599377c27ccb5513adb to your computer and use it in GitHub Desktop.
Adding Favicon and Apple Touch icon in WordPress using theme and plugin
This file contains 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
<?php | |
function add_apple_touch_icon</span>(){ | |
echo '<link rel="apple-touch-icon" href="'. get_template_directory_uri() .'images/apple-touch-icon.png">'; | |
} | |
add_action('wp_head','add_apple_touch_icon'); |
This file contains 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
<?php | |
/** | |
* Plugin Name: My Favicon | |
* Description: Activating a favicon into my site. | |
*/ | |
function add_my_favicon() { | |
$favicon_path = plugins_url( '/favicon.ico', __FILE__ ); | |
echo '<link rel="shortcut icon" href="'. $favicon_path .'" />'; | |
} | |
add_action( 'wp_head', 'add_my_favicon' ); //front end | |
add_action( 'admin_head', 'add_my_favicon' ); //admin end |
This file contains 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
<?php | |
function add_my_favicon() { | |
$favicon_path = get_template_directory_uri() . '/images/favicon.ico'; | |
echo '<link rel="shortcut icon" href="'. $favicon_path .'" />'; | |
} | |
add_action( 'wp_head', 'add_my_favicon' ); //front end | |
add_action( 'admin_head', 'add_my_favicon' ); //admin end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment