Skip to content

Instantly share code, notes, and snippets.

@mayeenulislam
Last active June 4, 2016 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayeenulislam/312bfefcdb008599377c27ccb5513adb to your computer and use it in GitHub Desktop.
Save mayeenulislam/312bfefcdb008599377c27ccb5513adb to your computer and use it in GitHub Desktop.
Adding Favicon and Apple Touch icon in WordPress using theme and plugin
<?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');
<?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
<?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